Terraform-provider-google: Uptime config keeps re-creating whenever deploy is done

Created on 6 Nov 2020  ·  4Comments  ·  Source: hashicorp/terraform-provider-google

resource "google_monitoring_uptime_check_config" "https" {
project = myproject
display_name = "Uptime check"
timeout = "10s"
period = "60s"

http_check {
path = "/"
port = "443"
use_ssl = true
validate_ssl = true
}

monitored_resource {
type = "uptime_url"
labels = {
host = "myhost"
}
}
lifecycle {
create_before_destroy = true
prevent_destroy = true
}
}

Uptime keeps destoryed and created whenever code is deployed. Why is this issue?

bug

Most helpful comment

I think what is happening here is that there is a label being added to the monitored_resource.labels by the API. In our examples this is shown being set to the project id: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/monitoring_uptime_check_config#example-usage---uptime-check-config-https

If you add this project_id label does it fix the issue for you?

Like this:

monitored_resource {
  type = "uptime_url"
  labels = {
    project_id = "your-project-id"
    host = "myhost"
  }
}

All 4 comments

Yes, I can repro it.

I think what is happening here is that there is a label being added to the monitored_resource.labels by the API. In our examples this is shown being set to the project id: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/monitoring_uptime_check_config#example-usage---uptime-check-config-https

If you add this project_id label does it fix the issue for you?

Like this:

monitored_resource {
  type = "uptime_url"
  labels = {
    project_id = "your-project-id"
    host = "myhost"
  }
}

thanks..it works after adding project_id under labels

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!

Was this page helpful?
0 / 5 - 0 ratings