-
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_cloudfunctions2_function event_filter causes "Provider produced inconsistent final plan" #20969
Comments
Hi @dan-drew I tried to replicate this issue, but everything looks good without errors. have you assigned the correct roles to use You may check the following used code (based on this example: link here) to check if you have the correct configuration:
If after this you are still having issues please share with us your full code of all involved resources WITHOUT USING MODULES, LOCALS OR VARIABLES to make a new try. For sensitive data you could use examples like:
|
Yes, everything works great when I don't hit this error and as I listed in the repro instructions I just have to run the exact same One thing that's different is that for some reason the resource ID in my case has been tagged as sensitive. I never do this explicitly so maybe an issue somewhere else in the google provider. A more full example would be like below with a couple module layers, but maybe you could try something simpler like adding a fake sensitive variable?
variable method_name {
type = string
default = "v1.compute.instances.start"
}
resource function... {
event_filter {
value = var.method_name
}
} Full Exampleterraform-module-1resource google_compute_instance instance {
# ...
}
output gcp_instance {
value = google_compute_instance.instance
} terraform-module-2module gcp_instance {
source = ".../terraform-module-1"
}
output gcp_instance {
value = module.gcp_instance.instance
} my-projectmodule instance {
source = "../terraform-module-2"
}
# NOTE: For some reason module.instance.gcp_instance is now marked SENSITIVE
resource "google_cloudfunctions2_function" "setup" {
# ...
event_trigger {
event_type = "google.cloud.audit.log.v1.written"
retry_policy = "RETRY_POLICY_RETRY"
event_filters {
attribute = "serviceName"
value = "compute.googleapis.com"
}
event_filters {
attribute = "methodName"
value = "v1.compute.instances.start"
}
event_filters {
attribute = "resourceName"
value = module.instance.gcp_instance.id # Marked SENSITIVE
}
}
} |
Sorry @dan-drew this is not clear at all, so were you able to solve it? |
No, just that I'm not blocked because the workaround is to run apply again. This was stated in the steps to reproduce:
The main additional info I added above is about whether "sensitive" values were tripping it up somehow. Previous errors I've gotten were specifically about the sensitive flag being inconsistent. If this isn't making sense or you can't repro, feel free to punt back to me until I have a chance to better repro myself with debug logging on. |
I tried again but everything works fine without errors with just 1 |
I'm experiencing something similar. Upgraded from provider v5.29.1 to v6.17.0 and then get an issue with google_cloud_run_v2_service resource (elided):
The plan shows as deleting all the existing env vars and creating new ones. Here is an elided service definition
Similarly, I was able to |
That's interesting, I've definitely also seen this when the only change was to the function env vars. |
Have you tried with the base terraform resources without using modules? |
@ggtisc is this question for me? no I have not tried that adding to my report, the "double apply" workaround does not actually work for me. or rather, any time there is a change to my cloud run service, the initial apply fails and a second apply is needed. (same error messages relating to env vars) this means that my CI pipelines continually fail, unless I built in double apply to the pipelines which doesn't seem great |
Please do it @micahjsmith, I've tried many times with the base code without modules, which means this is just a mistake in the configuration. |
Community Note
Terraform Version & Provider Version(s)
Terraform v1.9.8
on linux amd64
Affected Resource(s)
google_cloudfunctions2_function
Terraform Configuration
Debug Output
Let me know if needed, haven't run yet with full debug logging
Expected Behavior
Changes should apply successfully every time.
Actual Behavior
Every other time the plan runs, the following errors occur:
Steps to reproduce
Apply change for the first time to create the function
Make a change to the function code for example to cause it to need an update
Apply fails with errors described in Actual Behavior.
Immediate run apply again.
Apply succeeds as expected
Important Factoids
Authenticating as a user with full permissions to run the required operations.
References
No response
The text was updated successfully, but these errors were encountered: