-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_cloud_run_v2_service
causes faulty state if a manual Cloud Run revision was created between terraform plan and apply
#20496
Comments
Hi @Dragotic! In order to replicate this issue we need you to provide us with the variable data to which we do not have access. However, if it is sensitive information, you can provide us with any examples that can be used, but that correspond to the situation you are presenting. Example:
|
apply this, then include in the resource and re-apply:
Then, update the |
Thanks for clarifying The If you did changes through console you need to manually compare your Terraform configuration for this resource with the actual resource state in the GCloud console. Look for differences in properties like labels or container image versions. Here are two options depending on what you want to achieve:
After updating your Terraform code, run terraform apply to apply the changes to your infrastructure. Terraform will detect the differences between the desired state (your updated code) and the current state, and make the necessary modifications. Important Note: Make sure you understand the implications of each option before applying the changes. Option 1 essentially accepts the console changes into your Terraform configuration, while Option 2 discards them and enforces your Terraform-defined state. Here are some additional tips:
By following these steps, you can resolve the conflict between your Terraform code and the resource updated in the GCloud console and continue working with the resource effectively. |
Hey @ggtisc thank you so much for the response. However, I don't see how either option is the ideal for me. You have a cloud run managed by terraform and then something like the image is controlled by Google Cloud Build where a new image is pushed and updates the cloud Cloud Run service. When you use the |
@NickElliot could you help with this issue? Is it possible that you have another way to handle it? |
While this is a non-standard config, it is the point of the It seems the cause of this is likely that |
@NickElliot so what would be the move forward for this? I believe patching only the particular configuration that terraform tracks makes the most sense and should probably be the default behavior. When explicitly setting ignore changes on specific configuration then it shouldn't be included into the API patch request. |
@Dragotic could you just run I tried |
Community Note
Terraform Version & Provider Version(s)
Terraform v1.6.6
on darwin_arm64
Affected Resource(s)
google_cloud_run_v2_service
Terraform Configuration
The only important thing of the configuration is the lifecycle block
Debug Output
No response
Expected Behavior
Given an existing Cloud Run service with a container image with SHA
abcdefg
. And I want to update the scaling from 1 to 2 min instances.Timeline
terraform plan -out tf.plan
from 1 to 2
abcdefg
togfedcba
. The new revision is healthy.terraform apply tf.plan
(from step 1.)2
(from1
) with container image SHAgfedcba
Actual Behavior
The step 5 is different:
The new revision is correct with min instance set to
2
(from1
) but with container image SHAabcdefg
of the revision from step 1 and notgfedcba
from step 3 which is the latest healthy revision.Steps to reproduce
terraform plan -out tf.plan
ingore_changes
block will have same result)terraform apply tf.plan
Important Factoids
No response
References
No response
b/382557869
The text was updated successfully, but these errors were encountered: