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

Cannot update google_monitoring_uptime_check_config.period in place #2703

Closed
sergei-ivanov opened this issue Dec 18, 2018 · 2 comments · Fixed by #2781
Closed

Cannot update google_monitoring_uptime_check_config.period in place #2703

sergei-ivanov opened this issue Dec 18, 2018 · 2 comments · Fixed by #2781
Assignees
Labels

Comments

@sergei-ivanov
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 v0.11.11
+ provider.google v1.20.0

Affected Resource(s)

  • google_monitoring_uptime_check_config

Terraform Configuration Files

Before:

resource "google_monitoring_uptime_check_config" "test" {

  project      = "${var.project}"
  display_name = "Test"
  timeout      = "10s"
  period       = "300s"

  http_check = {
    path    = "/actuator/health"
    port    = "8443"
    use_ssl = true
  }

  monitored_resource {
    type = "uptime_url"

    labels = {
      project_id = "${var.project}"
      host       = "${google_compute_instance.test.network_interface.0.access_config.0.nat_ip}"
    }
  }

  selected_regions = [
    "EUROPE",
    "USA",
  ]
}

After:

resource "google_monitoring_uptime_check_config" "test" {

  project      = "${var.project}"
  display_name = "Test"
  timeout      = "10s"
  period       = "150s"
# ^^^^^^^^^^^^^^^^^^^^^ this value is altered

  http_check = {
    path    = "/actuator/health"
    port    = "8443"
    use_ssl = true
  }

  monitored_resource {
    type = "uptime_url"

    labels = {
      project_id = "${var.project}"
      host       = "${google_compute_instance.test.network_interface.0.access_config.0.nat_ip}"
    }
  }

  selected_regions = [
    "EUROPE",
    "USA",
  ]
}

Debug Output

2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: 2018/12/18 17:22:48 [DEBUG] Updating UptimeCheckConfig "projects/test/uptimeCheckConfigs/test": map[string]interface {}{"displayName":"Test", "period":"150s", "timeout":"10s", "selectedRegions":[]interface {}{"EUROPE", "USA"}, "httpCheck":map[string]interface{}{"useSsl":true, "port":8443, "path":"/actuator/health"}, "monitoredResource":map[string]interface {}{"type":"uptime_url", "labels":map[string]string{"project_id":"test", "host":"<redacted>"}}}
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: 2018/12/18 17:22:48 [DEBUG] Google API Request Details:
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: ---[ REQUEST ]---------------------------------------
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: PATCH /v3/projects/test/uptimeCheckConfigs/test?alt=json HTTP/1.1
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Host: monitoring.googleapis.com
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: User-Agent: Terraform/0.11.7 (+https://www.terraform.io) terraform-provider-google/1.20.0
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Content-Length: 276
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Content-Type: application/json
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Accept-Encoding: gzip
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: {
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "displayName": "Test",
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "httpCheck": {
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "path": "/actuator/health",
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "port": 8443,
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "useSsl": true
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  },
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "monitoredResource": {
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "labels": {
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:    "host": "<redacted>",
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:    "project_id": "test"
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   },
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "type": "uptime_url"
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  },
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "period": "150s",
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "selectedRegions": [
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "EUROPE",
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "USA"
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  ],
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:  "timeout": "10s"
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: }
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:
2018-12-18T17:22:48.610Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: -----------------------------------------------------
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: 2018/12/18 17:22:48 [DEBUG] Google API Response Details:
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: ---[ RESPONSE ]--------------------------------------
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: HTTP/2.0 400 Bad Request
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Cache-Control: private
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Content-Type: application/json; charset=UTF-8
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Date: Tue, 18 Dec 2018 17:22:48 GMT
2018-12-18T17:22:48.955Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Server: ESF
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Vary: Origin
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Vary: X-Origin
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: Vary: Referer
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: X-Content-Type-Options: nosniff
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: X-Frame-Options: SAMEORIGIN
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: X-Xss-Protection: 1; mode=block
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: 
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: {
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   "error": {
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:     "code": 400,
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:     "message": "Cannot change the period",
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:     "status": "INVALID_ARGUMENT"
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4:   }
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: }
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: 
2018-12-18T17:22:48.956Z [DEBUG] plugin.terraform-provider-google_v1.20.0_x4: -----------------------------------------------------
2018/12/18 17:22:48 [ERROR] root.main: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* google_monitoring_uptime_check_config.test: Error updating UptimeCheckConfig "projects/test/uptimeCheckConfigs/test": googleapi: Error 400: Cannot change the period
2018/12/18 17:22:48 [ERROR] root.main: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* google_monitoring_uptime_check_config.test: Error updating UptimeCheckConfig "projects/test/uptimeCheckConfigs/test": googleapi: Error 400: Cannot change the period

Panic Output

N/A

Expected Behavior

If the value cannot be updated in place, then the resource would need to be recreated.

Actual Behavior

Google Cloud API returns an error message.

Steps to Reproduce

  1. import the "before" configuration using terraform import
  2. apply the "after" changes to the configuration and run terraform apply

Important Factoids

N/A

References

@ghost ghost added the bug label Dec 18, 2018
@sergei-ivanov
Copy link
Author

There seem to be two problems here:

  1. The API only allows period to be one of 60, 300, 600, 900 seconds. The value of 150s is rejected when creating a new check. The message from the API is very clear when the value is incorrect, nothing needs to be done there.
  2. Even trying to change the period to a valid value of 60s, terraform apply fails with HTTP 400 from the API. It probably means that ForceNew: true needs to be set for period attribute.

@ghost
Copy link

ghost commented Feb 2, 2019

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!

@ghost ghost locked and limited conversation to collaborators Feb 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants