Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to ignore changes to k8s deployment pod images #2

Open
dzhlobo opened this issue Jun 6, 2021 · 0 comments
Open

Make it possible to ignore changes to k8s deployment pod images #2

dzhlobo opened this issue Jun 6, 2021 · 0 comments

Comments

@dzhlobo
Copy link
Member

dzhlobo commented Jun 6, 2021

Sometimes we deploy new images not via terraform but using kubectl:

kubectl -n $APP_NAME set image deployments/api *=$api_image_tag && \
kubectl -n $APP_NAME rollout status -w deployments/api

When we do this the next time we run terraform plan or apply it tries to reset image to the one from terraform config. It's possible to ignore by adding lifecycle block for kubernetes_deployment resource:

lifecycle {
  # we change image name during deployment outside of terraform
  ignore_changes = [
    spec[0].template[0].spec[0].container[0].image,
    spec[0].template[0].spec[0].init_container[0].image,
    spec[0].template[0].metadata[0].annotations["kubectl.kubernetes.io/restartedAt"]
  ]
}

If we do it right now it will no longer be possible to update image via terraform config and some app deploy via terraform.

It's not currently possible to make lifecycle dynamic in any way. Here's the issue about the problem: hashicorp/terraform#24188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant