Open alexanderlumix opened 1 month ago
Hi @alexanderlumix!
I tried to replicate this issue, but after creating the resources with terraform apply
and then destroying those same resources with terraform destroy
everything was successful without errors. They were deleted completely from the tfstate
file and from the cloud console on Monitoring Alerting
and Monitoring Uptime
Checks respectively.
Could you provide more information to see what is happening like your providers configuration without sharing sensitive information, just the structure you are using like this example:
provider "google" {
billing_project = "my-project"
project = "my-project"
region = "us-central1"
}
terraform {
required_providers {
google = {
# source = "hashicorp/google-beta"
version = "5.2.0"
}
}
}
Hi @alexanderlumix!
I tried to replicate this issue, but after creating the resources with
terraform apply
and then destroying those same resources withterraform destroy
everything was successful without errors. They were deleted completely from thetfstate
file and from the cloud console onMonitoring Alerting
andMonitoring Uptime
Checks respectively.Could you provide more information to see what is happening like your providers configuration without sharing sensitive information, just the structure you are using like this example:
provider "google" { billing_project = "my-project" project = "my-project" region = "us-central1" } terraform { required_providers { google = { # source = "hashicorp/google-beta" version = "5.2.0" } } }
Hey,
Did you use the metric.label.check_id in your filter? Because this is the part that is important, this what links the two resources.
terraform { required_providers { ... google = { source = "hashicorp/google" version = "5.2.0" } ... } }
Hi @alexanderlumix!
I used the same code you sent including the metric.label.check_id
for the condition_threshold
argument, as well as the terraform version and Google version. So maybe you just need to refresh your environment, check credentials, authentication and try again to run a new terraform apply. Also you could try to execute a terraform init -upgrade
before
Community Note
Terraform Version & Provider Version(s)
Terraform v1.7.3 on darwin_arm64
Affected Resource(s)
google_monitoring_uptime_check_config
Terraform Configuration
Before
After
Debug Output
google_monitoring_uptime_check_config.livekit-uptime-check: Destroying... [id=projects/example/uptimeCheckConfigs/service-uptime-check-9WA23SgrDNo] ╷ │ Error: Error when reading or editing UptimeCheckConfig: googleapi: Error 400: Request contains an invalid argument.
Expected Behavior
The resources should be deleted.
Actual Behavior
Resources are not deleted. I have found the culprit here which is the API behavior of https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs/delete In combination with an alert that uses a filter that includes:
This combination creates a link between the uptime check and alert that is presented here in UI:
And in UI is solved and presents the following dialog when you try to delete a check:
But if you try to delete the uptime check from the API and you will get a 400 error.
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" }
Steps to reproduce
terraform apply
Important Factoids
No response
References
No response