Skip to content
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_monitoring_uptime_check_config resource is always identified "change" wrongly #10884

Assignees
Labels

Comments

@liuchenggang2014
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the 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 Version

Terraform v1.1.2
on linux_amd64

  • provider registry.terraform.io/hashicorp/google v4.6.0

Affected Resource(s)

google_monitoring_uptime_check_config

  • google_XXXXX

Terraform Configuration Files

https://github.com/liuchenggang2014/uptime_check/blob/main/single/https_uptimecheck.tf

resource "google_monitoring_uptime_check_config" "https" {
  display_name = "https-uptime-check"
  timeout      = "10s"
  period = "60s"

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

  monitored_resource {
    type = "uptime_url"
    labels = {
      host       = "glb.goodvm.net"
    }
  }

}

Copy-paste your Terraform configurations here.

For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file.

For security, you can also encrypt the files using our GPG public key:

https://www.hashicorp.com/security

If reproducing the bug involves modifying the config file (e.g., apply a config,

change a value, apply the config again, see the bug), then please include both:

* the version of the config before the change, and

* the version of the config after the change.


### Debug Output

<!---
Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

To obtain the debug output, run `terraform apply` with the environment variable `TF_LOG=DEBUG`. See the [Terraform documentation on debugging](https://www.terraform.io/docs/internals/debugging.html) for more information.
--->

### Panic Output

<!--- If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`. --->

### Expected Behavior

terraform apply first. the result is fine.
but when I execute "terraform apply" again w/o any change.  it should do nothing



<!--- What should have happened? --->

### Actual Behavior

it prompt me : "Note: Objects have changed outside of Terraform"

<!--- What actually happened? --->

### Steps to Reproduce

<!--- Please list the steps required to reproduce the issue. --->

1. `terraform apply`
2.  terraform apply

### Important Factoids

<!--- Are there anything atypical about your accounts that we should know? For example: authenticating as a user instead of a service account? --->

### References

<!---
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests

Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
--->

* #0000

<!---
Note Google Cloud customers who are working with a dedicated Technical Account Manager / Customer Engineer: to expedite the investigation and resolution of this issue, please refer to these instructions: https://github.com/hashicorp/terraform-provider-google/wiki/Customer-Contact#raising-gcp-internal-issues-with-the-provider-development-team
--->
@shuyama1 shuyama1 self-assigned this Jan 11, 2022
@MatTerra
Copy link

👍🏽

@Ubaldo-Brea
Copy link

We are with the same problem in our project, this have be fixed

@dgteixeira
Copy link

Hello all, any update on this?

We can use a ignore_changes lifecycle block, but it is a not a ideal way.

Thanks!

@shuyama1
Copy link
Collaborator

Sorry for the delay on this issue. Would you mind sharing the debug log?

@shuyama1
Copy link
Collaborator

Could you try adding project_id to the labels block in your configuration and see if that solves your problem? Looks like it is required to be set in this case.

@Ubaldo-Brea
Copy link

Ubaldo-Brea commented Feb 28, 2022

Hi shuyama1, sorry my delay.
We added project_id to labels Block, it was part of our code as you can see below. I´m attached actual config state, the terraform code used for this state and a terraform plan showing the problem.
I hope this can help.
Thank you

Ubaldo Brea

actual config

 resource "google_monitoring_uptime_check_config" "url_https_check" {
    display_name     = "Uptime check"
    id               = "projects/projectx/uptimeCheckConfigs/uptime-check-pknFaR3gF7g"
    name             = "projects/projectx/uptimeCheckConfigs/uptime-check-pknFaR3gF7g"
    period           = "60s"
    project          = "projectx"
    selected_regions = [
        "EUROPE",
        "SOUTH_AMERICA",
        "ASIA_PACIFIC",
    ]
    timeout          = "60s"
    uptime_check_id  = "uptime-check-pknFaR3gF7g"
    http_check {
        headers        = {}
        mask_headers   = false
        path           = "/probe_files/potato"
        port           = 443
        request_method = "GET"
        use_ssl        = true
        validate_ssl   = true
    }
    monitored_resource {
        labels = {
            "host"       = "fileserver.host.com."
            "project_id" = "projectx"
        }
        type   = "uptime_url"
    }
}

actual terraform code

resource "google_monitoring_uptime_check_config" "url_https_check" {
  project          = data.google_project.this.name
  display_name     = "uptime check"
  timeout          = "60s"
  period           = "60s"
  selected_regions = ["EUROPE", "SOUTH_AMERICA", "ASIA_PACIFIC"]
  http_check {
    request_method = "GET"
    path           = google_storage_bucket_object.probe_folder_file.name
    port           = "443"
    use_ssl        = true
    validate_ssl   = true
  }
  monitored_resource {
    type = "uptime_url"
    labels = {
      project_id = var.project_id
      host       = google_dns_record_set.fileserver_public.name
    }
  }
  depends_on = [google_compute_managed_ssl_certificate.fileserver]
}

terraform plan output

Terraform will perform the following actions:
   google_monitoring_uptime_check_config.url_https_check will be updated in-place

  ~ resource "google_monitoring_uptime_check_config" "url_https_check" {
        id               = "projects/Projectx/uptimeCheckConfigs/cperepo-uptime-check-pknFaR3gF7g"
        name             = "projects/Projectx/uptimeCheckConfigs/cperepo-uptime-check-pknFaR3gF7g"
        # (6 unchanged attributes hidden)
      ~ http_check {
          ~ path           = "/probe_files/potato" -> "probe_files/potato"
            # (6 unchanged attributes hidden)
        }
        # (1 unchanged block hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

@shuyama1
Copy link
Collaborator

shuyama1 commented Mar 7, 2022

Hi @Ubaldo-Brea! Thanks for the information provided. Looks like the API is adding a \ if the provided path does not begin with "/", and therefore it creates a permadiff for path field in Terraform. I am working on a PR to fix it and it should be out by tomorrow. Sorry for the delay on this issue!

Hi All! Does anyone still see some other errors other than the path issue I mentioned above after adding project_id to the labels block?

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.