hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.28k stars 1.72k forks source link

Cannot unlink billing account #133

Closed ubschmidt2 closed 7 years ago

ubschmidt2 commented 7 years ago

Terraform Version

Terraform v0.10.0-dev (9706042ddd51b85a46e23356536a1d812efa5a38+CHANGES)

Affected Resource(s)

Terraform Configuration Files

provider "google" {
  region  = "us-central1"
}

resource "google_project" "project" {
  name            = "stschmidt-tf-022"
  project_id      = "stschmidt-tf-022"
  org_id = <withheld>
  # billing_account = "<withheld>"
}

Debug Output

2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: -----------------------------------------------------
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 2017/06/16 14:32:39 [DEBUG] Google API Request Details:
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: ---[ REQUEST ]---------------------------------------
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: PUT http://cloudbilling.googleapis.com/v1/projects/stschmidt-tf-022/billingInfo?alt=json HTTP/1.1
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Host: cloudbilling.googleapis.com
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: User-Agent: google-api-go-client/0.5 (linux amd64) Terraform/0.9.8
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Content-Length: 42
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Content-Type: application/json
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Accept-Encoding: gzip
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: {"billingAccountName":"billingAccounts/"}
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: -----------------------------------------------------
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 2017/06/16 14:32:39 [DEBUG] Google API Response Details:
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: ---[ RESPONSE ]--------------------------------------
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: HTTP/2.0 400 Bad Request
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Cache-Control: private
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Content-Type: application/json; charset=UTF-8
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Date: Fri, 16 Jun 2017 12:32:39 GMT
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Server: ESF
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Vary: Origin
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Vary: X-Origin
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: Vary: Referer
...
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: {
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:   "error": {
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:     "code": 400,
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:     "message": "Request contains an invalid argument.",
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:     "errors": [
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:       {
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:         "message": "Request contains an invalid argument.",
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:         "domain": "global",
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:         "reason": "badRequest",
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:         "debugInfo": "detail: \"[ORIGINAL ERROR] generic::invalid_argument: com.google.apps.framework.request.BadRequestException: Invalid value for field: billing_account_name\"\n"
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:       }
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:     ],
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:     "status": "INVALID_ARGUMENT"
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google:   }
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: }
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: 
2017/06/16 14:32:39 [DEBUG] plugin: terraform-provider-google: -----------------------------------------------------

Expected Behavior

Should successfully unlink the billing account.

Actual Behavior

Looks like an attempt to set the billing account reference to an empty string.

google_project.project: Refreshing state... (ID: stschmidt-tf-022)
google_project.project: Modifying... (ID: stschmidt-tf-022)
  billing_account: "<withheld>" => ""
Error applying plan:

1 error(s) occurred:

* google_project.project: 1 error(s) occurred:

* google_project.project: Error updating billing account "" for project "projects/stschmidt-tf-022": googleapi: Error 400: Request contains an invalid argument., badRequest

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

References

danawillow commented 7 years ago

This is blocked on https://github.com/terraform-providers/terraform-provider-google/issues/93

ubschmidt2 commented 7 years ago

Doesn't seem to depend on #93.

danawillow commented 7 years ago

Ah ok, I noticed the alpha API you listed and assumed it required that one but you're right, looks like it can be done with the APIs as they are now.

ghost commented 4 years ago

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!