Terraform version: 1.14.2
Kubernetes Provider version: 2.0.1
Kubernetes version: 1.17
In my terraform .tf code I have a kubernetes_deployment which specifies an image property on the container. Right now it's myservice:latest inside terraform. This works perfectly fine for an initial release.
Sometime later, our CI/CD process comes along, builds a new image, gives it an updated tag (say, ABCD) and pushes ABCD to the registry and then calls kubectl set image deployment/foo myservice:ABCD. This also works as expected.
The problem then comes in, the next time I run a terraform plan terraform sees that the image is myservice:ABCD instead of myservice:latest and it then plans an update to the image field to reset it to myservice:latest which is undesirable. Is there anyway to have terraform ignore deltas in the image field after initial creation?
Have you looked into https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes?
I had not! Somehow in my searching for an answer to this one I had not come across this. Looks like exactly what I need! Thanks a ton for the quick response.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
Most helpful comment
I had not! Somehow in my searching for an answer to this one I had not come across this. Looks like exactly what I need! Thanks a ton for the quick response.