-
Notifications
You must be signed in to change notification settings - Fork 994
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
🐛 Fix the wait conditions issue in the kubernetes_manifest resource #2173
Conversation
@@ -36,7 +40,7 @@ resource "google_service_account" "default" { | |||
|
|||
resource "google_container_cluster" "primary" { | |||
provider = google-beta | |||
name = "tf-acc-test-${random_id.cluster_name.hex}" | |||
name = var.cluster_name != "" ? var.cluster_name : "tf-acc-test-${random_id.cluster_name.hex}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not related to the fix directly, however, I found this useful to configure the cluster name for manual testing purposes while working on this issue.
7d2c7e1
to
161995e
Compare
… add read operation once wait conditions are passed
2bbdbd7
to
b69b7f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for fixing this 🚀
Description
This PR fixes an issue in the
kubernetes_manifest
manifest when it is used with thewait
conditions. This happens because the provider works with the object that the Kubernetes cluster returns after creation and doesn't update the object(request a newer version) once the conditions are met. Because of that the initial object(the one that the provider receives right after the create call) ends up in the TF state and some attributes are not available for the reference. A good example here can bemetadata.labels
andmetadata.annotations
that controllers assign to the Kubernetes objects after their creation.metadata.labels
andmetadata.annotations
are often used in thewait
conditions and as an input for other resources to be created or outputs for further usage.Changes:
wait
condition code right after the resource creation to fail earlier in the case of any issue that occurs during the waiting time.wait
conditions are met successfully.For example, the following code will be executed with the "Invalid index" error message:
That happens because the annotation
kubernetes.io/service-account.uid
is not available right after the resource creation and added by a controller for some time(that is why the condition is used here). The second apply will be successful.Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Fix: #1957
Community Note