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

send maintenance_window.hour even if it's zero, since that's a valid value #2630

Merged
merged 1 commit into from
Dec 12, 2018

Conversation

modular-magician
Copy link
Collaborator

@danawillow danawillow merged commit 97a2d6b into hashicorp:2.0.0 Dec 12, 2018
@gburiola
Copy link

Hey @paddycarver / @danawillow , will this fix an issue like the one describe below?

  1. settings.maintenance_window is NOT defined on terraform code

  2. Apply creates the database_instance correctly

  3. Second run of apply shows the following diff:

    ~ google_sql_database_instance.NAME
        settings.0.maintenance_window.#: "0" => "1"
    

Trying to apply the diff above fails with:

* google_sql_database_instance.NAME: Error, failed to update instance NAME: googleapi: 
  Error 400: This operation isn"t valid for this instance., invalidOperation

That is probably because the PUT request contains an empty maintenanceWindow:

plugin.terraform-provider-google_v1.20.0_x4: ---[ REQUEST ]---------------------------------------
plugin.terraform-provider-google_v1.20.0_x4: PUT /sql/v1beta4/projects/PROJECT/instances/NAME?alt=json&prettyPrint=false HTTP/1.1
plugin.terraform-provider-google_v1.20.0_x4: Host: www.googleapis.com
plugin.terraform-provider-google_v1.20.0_x4: User-Agent: google-api-go-client/0.5 Terraform/0.11.7 (+https://www.terraform.io) terraform-provider-google/1.20.0
plugin.terraform-provider-google_v1.20.0_x4: Content-Length: 2773
plugin.terraform-provider-google_v1.20.0_x4: Content-Type: application/json
plugin.terraform-provider-google_v1.20.0_x4: Accept-Encoding: gzip
plugin.terraform-provider-google_v1.20.0_x4:
plugin.terraform-provider-google_v1.20.0_x4: {
plugin.terraform-provider-google_v1.20.0_x4:  "backendType": "SECOND_GEN",
plugin.terraform-provider-google_v1.20.0_x4:  "connectionName": "PROJECT:europe-west2:NAME",
plugin.terraform-provider-google_v1.20.0_x4:  "databaseVersion": "MYSQL_5_7",
plugin.terraform-provider-google_v1.20.0_x4:  "instanceType": "CLOUD_SQL_INSTANCE",
plugin.terraform-provider-google_v1.20.0_x4:  "settings": {
<REMOVED A FEW LINES>
plugin.terraform-provider-google_v1.20.0_x4:   "locationPreference": {},
plugin.terraform-provider-google_v1.20.0_x4:   "maintenanceWindow": {},
plugin.terraform-provider-google_v1.20.0_x4:   "pricingPlan": "PER_USE",
plugin.terraform-provider-google_v1.20.0_x4:   "replicationType": "SYNCHRONOUS",
plugin.terraform-provider-google_v1.20.0_x4:   "settingsVersion": "1",
plugin.terraform-provider-google_v1.20.0_x4:   "tier": "db-n1-standard-1"


plugin.terraform-provider-google_v1.20.0_x4: ---[ RESPONSE ]--------------------------------------
plugin.terraform-provider-google_v1.20.0_x4: HTTP/2.0 400 Bad Request
plugin.terraform-provider-google_v1.20.0_x4: Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
plugin.terraform-provider-google_v1.20.0_x4: Cache-Control: private, max-age=0
plugin.terraform-provider-google_v1.20.0_x4: Content-Type: application/json; charset=UTF-8
plugin.terraform-provider-google_v1.20.0_x4: Date: Tue, 18 Dec 2018 17:44:23 GMT
plugin.terraform-provider-google_v1.20.0_x4: Expires: Tue, 18 Dec 2018 17:44:23 GMT
plugin.terraform-provider-google_v1.20.0_x4: Server: GSE
plugin.terraform-provider-google_v1.20.0_x4: Vary: Origin
plugin.terraform-provider-google_v1.20.0_x4: Vary: X-Origin
plugin.terraform-provider-google_v1.20.0_x4: X-Content-Type-Options: nosniff
plugin.terraform-provider-google_v1.20.0_x4: X-Frame-Options: SAMEORIGIN
plugin.terraform-provider-google_v1.20.0_x4: X-Xss-Protection: 1; mode=block
plugin.terraform-provider-google_v1.20.0_x4:
plugin.terraform-provider-google_v1.20.0_x4: {
plugin.terraform-provider-google_v1.20.0_x4:  "error": {
plugin.terraform-provider-google_v1.20.0_x4:   "errors": [
plugin.terraform-provider-google_v1.20.0_x4:    {
plugin.terraform-provider-google_v1.20.0_x4:     "domain": "global",
plugin.terraform-provider-google_v1.20.0_x4:     "reason": "invalidOperation",
plugin.terraform-provider-google_v1.20.0_x4:     "message": "This operation isn\"t valid for this instance."
plugin.terraform-provider-google_v1.20.0_x4:    }
plugin.terraform-provider-google_v1.20.0_x4:   ],
plugin.terraform-provider-google_v1.20.0_x4:   "code": 400,
plugin.terraform-provider-google_v1.20.0_x4:   "message": "This operation isn\"t valid for this instance."
plugin.terraform-provider-google_v1.20.0_x4:  }
plugin.terraform-provider-google_v1.20.0_x4: }

@danawillow
Copy link
Contributor

Hmm, just glancing at it that looks different to me. Can you file a new issue for that?

@gburiola
Copy link

Thanks Dana.

I've opened #2716

@ghost
Copy link

ghost commented Jan 11, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jan 11, 2019
@modular-magician modular-magician deleted the codegen-pr-1024 branch November 16, 2024 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants