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 a user, that user is claiming responsibility for the issue.
Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.
2024-10-09T12:49:23.918Z [WARN] Provider "registry.terraform.io/hashicorp/google" produced an invalid plan for google_billing_budget.budget["evd"], but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
.threshold_rules[0].spend_basis: planned value cty.StringVal("CURRENT_SPEND") for a non-computed attribute
.threshold_rules[1].spend_basis: planned value cty.StringVal("CURRENT_SPEND") for a non-computed attribute
.threshold_rules[2].spend_basis: planned value cty.StringVal("CURRENT_SPEND") for a non-computed attribute
.all_updates_rule[0].schema_version: planned value cty.StringVal("1.0") for a non-computed attribute
.budget_filter[0].credit_types_treatment: planned value cty.StringVal("INCLUDE_ALL_CREDITS") for a non-computed attribute
google_billing_budget.budget["evd"]: Creating...
2024-10-09T12:49:23.920Z [INFO] Starting apply for google_billing_budget.budget["evd"]
2024-10-09T12:49:23.926Z [INFO] provider.terraform-provider-google_v4.55.0_x5: 2024/10/09 12:49:23 [DEBUG] Google API Request Details:
with google_billing_budget.budget["evd"],
on main.tf line 62, in resource "google_billing_budget" "budget":
62: resource "google_billing_budget" "budget" {
Expected Behavior
Create the billing budget for the specified google project which is linked to a billing account
with google_billing_budget.budget["evd"],
on main.tf line 62, in resource "google_billing_budget" "budget":
62: resource "google_billing_budget" "budget" {
Steps to reproduce
terraform apply
Important Factoids
terraform plan generated the following:
google_billing_budget.budget["evd"] will be created
I've tried running the same config with latest version of the provider (registry.terraform.io/hashicorp/google v6.6.0), still faced the same error.
Also, I've successfully created billing budget for the same project using my user account with the Owner role via the Budgets & Alerts section in the Google Cloud Platform (GCP) UI.
Additionally, the following APIs are enabled for the project: stackdriver.googleapis.com, billingbudgets.googleapis.com, cloudbilling.googleapis.com, servicemanagement.googleapis.com, monitoring.googleapis.com, serviceusage.googleapis.com.
Despite following Google's documentation which states that users can create budgets for projects they own even with limited or no access to the Cloud Billing account https://cloud.google.com/billing/docs/how-to/budgets#permissions-project. In my case, the service account utilized by Terraform has substantial project-level permissions, including the roles of Owner, Monitoring Editor, Service Management Administrator, and Service Usage Admin. However, I encounter issues when trying to manage billing budgets via Terraform. Could there be a missing configuration, permission, or is this a potential bug in Terraform?
@RaginiDhatric I had the same issue. The fix was changing the currency code to match my Country/Region in Billing--> Payment Settings --> Country/Region. Hopefully, this helps!
Community Note
Terraform Version & Provider Version(s)
Terraform version: 1.4.6 on
Affected Resource(s)
google_billing_budget
Terraform Configuration
Debug Output
2024-10-09T12:49:23.918Z [WARN] Provider "registry.terraform.io/hashicorp/google" produced an invalid plan for google_billing_budget.budget["evd"], but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations:
2024-10-09T12:49:23.926Z [INFO] provider.terraform-provider-google_v4.55.0_x5: 2024/10/09 12:49:23 [DEBUG] Google API Request Details:
---[ REQUEST ]--------------------------------------- POST /v1/billingAccounts/00xxxx-xxxxxx-xxxxxx/budgets?alt=json HTTP/1.1 Host: billingbudgets.googleapis.com User-Agent: Terraform/1.4.6 (+https://www.terraform.io/) Terraform-Plugin-SDK/2.10.1 terraform-provider-google/4.55.0 Content-Length: 841 Content-Type: application/json Accept-Encoding: gzip
{ "amount": { "specifiedAmount": { "currencyCode": "USD", "units": "2000" } }, "budgetFilter": { "creditTypesTreatment": "INCLUDE_ALL_CREDITS", "projects": [ "projects/evd" ] }, "displayName": "GCP Budget Alert for evd", "notificationsRule": { "disableDefaultIamRecipients": true, "monitoringNotificationChannels": [ "projects/evd/notificationChannels/xxxxxxxxxxxxxxx687" ], "schemaVersion": "1.0" }, "thresholdRules": [ { "spendBasis": "CURRENT_SPEND", "thresholdPercent": 0.5 }, { "spendBasis": "CURRENT_SPEND", "thresholdPercent": 0.9 }, { "spendBasis": "CURRENT_SPEND", "thresholdPercent": 1 } ] }
2024-10-09T12:49:25.004Z [INFO] provider.terraform-provider-google_v4.55.0_x5: 2024/10/09 12:49:25 [DEBUG] Google API Response Details: ---[ RESPONSE ]-------------------------------------- HTTP/2.0 400 Bad Request Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Cache-Control: private Content-Type: application/json; charset=UTF-8 Date: Wed, 09 Oct 2024 12:49:24 GMT Server: ESF Vary: Origin Vary: X-Origin Vary: Referer X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } }
Error: Error creating Budget: googleapi: Error 400: Request contains an invalid argument.
with google_billing_budget.budget["evd"], on main.tf line 62, in resource "google_billing_budget" "budget": 62: resource "google_billing_budget" "budget" {
Expected Behavior
Create the billing budget for the specified google project which is linked to a billing account
Actual Behavior
Error: Error creating Budget: googleapi: Error 400: Request contains an invalid argument.
with google_billing_budget.budget["evd"], on main.tf line 62, in resource "google_billing_budget" "budget": 62: resource "google_billing_budget" "budget" {
Steps to reproduce
terraform apply
Important Factoids
terraform plan generated the following:
resource "google_billing_budget" "budget" {
billing_account = "00xxxx-xxxxxx-xxxxxx"
display_name = "FDPlan GCP Budget Alert for evd"
id = (known after apply)
name = (known after apply)
all_updates_rule {
amount {
budget_filter {
threshold_rules {
threshold_rules {
threshold_rules {
I've tried running the same config with latest version of the provider (registry.terraform.io/hashicorp/google v6.6.0), still faced the same error.
Also, I've successfully created billing budget for the same project using my user account with the Owner role via the Budgets & Alerts section in the Google Cloud Platform (GCP) UI.
Additionally, the following APIs are enabled for the project: stackdriver.googleapis.com, billingbudgets.googleapis.com, cloudbilling.googleapis.com, servicemanagement.googleapis.com, monitoring.googleapis.com, serviceusage.googleapis.com.
Despite following Google's documentation which states that users can create budgets for projects they own even with limited or no access to the Cloud Billing account https://cloud.google.com/billing/docs/how-to/budgets#permissions-project. In my case, the service account utilized by Terraform has substantial project-level permissions, including the roles of Owner, Monitoring Editor, Service Management Administrator, and Service Usage Admin. However, I encounter issues when trying to manage billing budgets via Terraform. Could there be a missing configuration, permission, or is this a potential bug in Terraform?
References
No response
b/374104774