Closed bskaplan closed 1 week ago
@zli82016 possibly this is expected? The diff looks like:
resource "google_cloud_run_service" "default" {
id = "locations/us-central1/namespaces/ci-test-project-188019/services/tftest-cloudrun-lohq0k"
name = "tftest-cloudrun-lohq0k"
# (4 unchanged attributes hidden)
~ metadata {
~ effective_annotations = {
+ "run.googleapis.com/launch-stage" = (known after apply)
# (6 unchanged elements hidden)
}
# (9 unchanged attributes hidden)
}
# (2 unchanged blocks hidden)
}
This is expected. If you don't use any beta features, run.googleapis.com/launch-stage: BETA
should not be included in the Terraform configuration.
The case that is failing is when you previously created a resource using a beta feature and then update the service to not use a beta feature. Removing the launch-stage: BETA annotation from the updated resource does not fix this issue.
The case that is failing is when you previously created a resource using a beta feature and then update the service to not use a beta feature. Removing the launch-stage: BETA annotation from the updated resource does not fix this issue.
Removing the launch-stage: BETA annotation from the updated resource config should remove the diffs below
resource "google_cloud_run_service" "default" {
id = "locations/us-central1/namespaces/ci-test-project-188019/services/tftest-cloudrun-lohq0k"
name = "tftest-cloudrun-lohq0k"
# (4 unchanged attributes hidden)
~ metadata {
~ effective_annotations = {
+ "run.googleapis.com/launch-stage" = (known after apply)
# (6 unchanged elements hidden)
}
# (9 unchanged attributes hidden)
}
# (2 unchanged blocks hidden)
}
Can you provide more details for the reason that removing the launch-stage: BETA annotation from the updated resource does not fix this issue? What issue do you mean here?
@bskaplan
The steps to reproduce this issue are not clear. To reproduce this issue, can we use any configuration of a google_cloud_run_service
that uses google-beta
and after the 1st terraform apply
removes the use of google-beta
and run a 2nd terraform apply
?
Or is it necessary to use a specific terraform code? because I see many of them in the provided link
I linked directly to the line of the specific test that demonstrates this issue. It has to do with using Cloud Run preview features, not necessarily the google-beta provider. When a feature is in preview, Cloud Run requires you specify the annotation "run.googleapis.com/launch-stage" = "BETA"
.
If you subsequently remove the dependency on the Cloud Run preview feature and remove the "run.googleapis.com/launch-stage" = "BETA"
annotation and then apply that, Terraform is still showing a diff in effective_annotations
for the run.googleapis.com/launch-stage
annotation that should have just been removed..
The annotations
is inside ignore_changes
block, which prevents applying the removing of run.googleapis.com/launch-stage" = "BETA"
.
There is a pending PR to fix it https://github.com/GoogleCloudPlatform/magic-modules/pull/11531
@zli82016 would it be appropriate to do a merge of both issues, or forward this one?
@bskaplan, can you please remove the lifecycle.ignore_changes
from the test case testAccCloudRunService_cloudRunServiceWithEmptyDirVolume
and testAccCloudRunService_cloudRunServiceUpdateWithGcsVolume
in the PR https://github.com/GoogleCloudPlatform/magic-modules/pull/11503? And then the PR https://github.com/GoogleCloudPlatform/magic-modules/pull/11531 is not needed.
https://github.com/GoogleCloudPlatform/magic-modules/pull/11503 is merged with the test fix.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.9.3 on linux_amd64
Affected Resource(s)
google_cloud_run_service
Terraform Configuration
see test at https://github.com/GoogleCloudPlatform/magic-modules/blob/bc5def9f8136003836911e78567dc8849a39be6d/mmv1/third_party/terraform/services/cloudrun/resource_cloud_run_service_test.go.erb#L1315
Debug Output
https://gist.github.com/bskaplan/560b83679746aa53fdd6ff24f8b89cdf
Expected Behavior
Test should have completed successfully
Actual Behavior
There was an unexpected diff in effective_annotations for run.googleapis.com/launch-stage
Steps to reproduce
terraform apply
a service with a feature that is in beta and set the annotationrun.googleapis.com/launch-stage: beta
.terraform apply
againImportant Factoids
The launch-stage annotation in Cloud Run is a bit weird. On input, it represents the launch stage that you want to allow for new features. The server will respond with the launch stage required for the features used. So if you deploy with
launch-stage: BETA
but do not use any beta features, the launch stage annotation is removed from the response.References
This came up while working on https://github.com/GoogleCloudPlatform/magic-modules/pull/11503