Open foosinn opened 11 months ago
The way kubectl rollout restart
works is by patching the deployment template with the kubectl.kubernetes.io/restartedAt
annotation. Rather than adding a new resource for this, you could use the kubernetes_annotations resource to do the same thing:
resource "time_static" "restarted_at" {}
resource "kubernetes_annotations" "example" {
api_version = "apps/v1"
kind = "Deployment"
metadata {
name = "nginx-deployment"
}
template_annotations = {
"kubectl.kubernetes.io/restartedAt" = time_static.restarted_at.rfc3339
}
}
Description
This would allow terraform to restart deployments. Especially useful after deploying other things
Potential Terraform Configuration
References
This would provide a much cleaner alternative to https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/master/modules/acm/creds.tf#L85-L99, that also respects current context and network settings.
Community Note