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

Question: Record "Change Cause" in Rollout History #2204

Closed
KyleKing opened this issue Jul 27, 2023 · 2 comments
Closed

Question: Record "Change Cause" in Rollout History #2204

KyleKing opened this issue Jul 27, 2023 · 2 comments
Labels

Comments

@KyleKing
Copy link

Question

I wondered if it was possible to configure the Kubernetes provider in a way that the change cause was recorded in the rollout history? I've searched through issues and the documentation and haven't come across a relevant setting, but I might be missing something.


To replicate, run terraform apply against an AWS EKS cluster and then check rollout history with:

kubectl rollout history deployment <deployment>

Which just returns:

REVISION  CHANGE-CAUSE
1         <none>
2         <none>
3         <none>
4         <none>

From the kubectl documentation, the change cause can be documented by setting --record=true (https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands). I'm not sure if there is something similar in the API that this provider could or does leverage

Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.

@jrhouston
Copy link
Collaborator

jrhouston commented Jul 31, 2023

Just FYI the --record flag is actually being deprecated. If you wanted to replicate what this flag does, though, you can just set the kubernetes.io/change-cause annotation on the Deployment metadata like this:

resource "kubernetes_deployment" "example" {
  metadata {
    # ...
    annotations = {
      "kubernetes.io/change-cause" = "terraform apply"
    }
  }
  # ...
}

and it will show up like this:

REVISION  CHANGE-CAUSE
1         terraform apply

@KyleKing
Copy link
Author

I wasn't aware of the annotation and that should meet our needs. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants