modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.Terraform v0.12.20
+ provider.google v3.7.0
+ provider.google-beta v3.7.0
+ provider.null v2.1.2
+ provider.random v2.2.1
+ provider.template v2.1.2
No perma-diff
terraform apply repeatedly produces the plan:
~ resource "google_cloud_run_service" "default" {
# ...
~ template {
- metadata {
- annotations = {
- "autoscaling.knative.dev/maxScale" = "1000"
} -> null
- generation = 0 -> null
- labels = {} -> null
}
~ spec {
- container_concurrency = 80 -> null
service_account_name = "..."
~ containers {
args = []
command = []
image = "..."
- resources {
- limits = {
- "cpu" = "1000m"
- "memory" = "256M"
} -> null
- requests = {} -> null
}
}
}
}
# ...
}
terraform applyterraform applyI am interested in working on this issue. Is this issue appropriate for beginners?
@menarulalam thank you for your interest! However I took a quick look at this yesterday and I think it's going to be a bit more involved of a fix as the fields that are now coming back from the API are complex types that might need some custom logic.
The root cause here is that CloudRun has started returning default values that weren't previously exposed. This means that all versions of this resource are currently affected. I have reached out to their team to see if it's possible to address this in the API. (b/148965108)
It's further complicated that these fields appear to be affected by a bug in Terraform core so I'm unable to fix it in the provider at this time. Marking these fields as computed will still continue to show a permadiff. The Terraform bug is https://github.com/hashicorp/terraform/issues/24044.
I'll open the PR but will wait to merge until 1 of the teams is able to work on the upstream bug.
I have learned that this is expected Terraform behavior and have adjusted my PR to be able to handle deeply nested default values. The API team is unable to address the upstream issue at this time so it looks like the fix will be coming in 3.8.0.
In the mean time you can manually work around this permadiff by manually specifying the defaulted values in your config. Here's an example with the defaults explicit:
resource "google_cloud_run_service" "default" {
name = "tftest-cloudrun"
location = "us-central1"
template {
metadata {
annotations = {
"autoscaling.knative.dev/maxScale" = "1000" //explicit
}
}
spec {
container_concurrency = 80 //explicit
containers {
image = "gcr.io/cloudrun/hello"
resources {
limits = {
"cpu" = "1000m" //explicit
"memory" = "256M" //explicit
}
}
}
}
}
traffic {
percent = 100
latest_revision = true
}
}
Thanks @chrisst. Yes, this is exactly the workaround I use to silence the perma-diff for now.
Fixed in https://github.com/GoogleCloudPlatform/magic-modules/pull/3081 which was shipped in 3.8.0
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!