-
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
Cannot update google_monitoring_alert_policy if related google_monitoring_notification_channel is deleted #3008
Comments
The only way to mitigate this at the moment is to remove the notification channel association from the monitoring policy manually: $ gcloud alpha monitoring policies update --project=dev --remove-notification-channels=projects/dev/notificationChannels/6510479629081562055 projects/dev/alertPolicies/9007997391602347955 After that terraform plan can be reapplied. |
This bug still exists in Terraform 0.12 too. |
I can repro it with v3.16.0
|
This is an issue in upstream Terraform, unfortunately. It decides the order that changes like this are made to resources and we can't do anything about it in the provider (which operates on a single-resource-at-a-time basis). I don't know any canonical issue for this problem. If it remains a problem, I'd suggest filing a new one (and link back here!). |
One option might be to annotate A more generic issue on the Terraform side is probably this one: |
Yep, this statement from that issue describes the problem we're encountering:
That's based on this config: resource "foo" "bar" {
foobar = "${file("foobar")}"
}
resource "bar" "foo" {
depends_on = ["foo.bar"]
} We're seeing a similar behaviour here, where Terraform wants to modify the notification channel before the alert policy even though it needs to do it in the opposite order. In some cases, |
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! |
Community Note
Terraform Version
Terraform v0.11.11
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
N/A
Expected Behavior
The list of email addresses is stored in a variable and is used to create a list of notification channels.
A monitoring policy is dependent on the list of notification channels in turn.
If an email is removed from the list, Terraform needs to update the policy before destroying the notification channel.
Actual Behavior
Terraform attempts to destroy notification channel before removing it from the associated policy. That fails with an error because the policy still refers to the notification channel.
Steps to Reproduce
terraform apply
with the "INITIAL" version ofterraform.tfvars
terraform apply
with the "MODIFIED" version ofterraform.tfvars
Important Factoids
N/A
References
N/A
The text was updated successfully, but these errors were encountered: