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.33k stars 1.74k forks source link

google_billing_budget: Can not update the budget amount #9440

Closed n-yassine closed 3 years ago

n-yassine commented 3 years ago

Community Note

Terraform Version

0.13

Affected Resource(s)

Terraform Configuration Files

provider "google" {
  region  = "europe-west1" 
  version = "~> 3.72.0" 
}

provider "google-beta" {
  region  = "europe-west1"
  version = "~> 3.72.0"
}

resource "google_billing_budget" "budget" {
  billing_account = 01D737-CD1044-XXXXXX
  display_name = "BILLING ALERT"
  amount {
    specified_amount {
      currency_code = "EUR"
      units = "2000"
    }
  }
  threshold_rules {
      threshold_percent =  0.5
  }
}

Debug Output

  ~ update in-place
Terraform will perform the following actions:
  # google_billing_budget.budget[0] will be updated in-place
  ~ resource "google_billing_budget" "budget" {
        billing_account = "01D737-CD1044-XXXXXX"
        display_name    = "BILLING ALERT"
        id              = "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd0784XXXXX"
        name            = "c94a583e-c984-41b0-887f-cd07XXXX"
      ~ amount {
            last_period_amount = false
          ~ specified_amount {
                currency_code = "EUR"
                nanos         = 0
              ~ units         = "5000" -> "2000"
            }
        }
        budget_filter {
            credit_types           = []
            credit_types_treatment = "INCLUDE_ALL_CREDITS"
            labels                 = {}
            projects               = [
                "projects/567566208151",
            ]
            services               = []
            subaccounts            = []
        }
        threshold_rules {
            spend_basis       = "CURRENT_SPEND"
            threshold_percent = 0.5
        }
    }
Plan: 0 to add, 1 to change, 0 to destroy

Panic Output

Expected Behavior

Change the budget amount from 5000 to 2000

Actual Behavior

This does not update the budget amount

Steps to Reproduce

  1. terraform apply

Important Factoids

References

edwardmedia commented 3 years ago

@yassine-naamane can you share the debug log?

n-yassine commented 3 years ago
[DEBUG] Updating Budget "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693": map[string]interface {}{"amount":map[string]interface {}{"specifiedAmount":map[string]interface {}{"currencyCode":"EUR", "units":"2000"}}, "budgetFilter":map[string]interface {}{"creditTypesTreatment":"INCLUDE_ALL_CREDITS", "projects":[]interface {}{"projects/567566XXXXXX"}}, "displayName":"IRN-69801", "notificationsRule":map[string]interface {}{"disableDefaultIamRecipients":true, "monitoringNotificationChannels":[]interface {}{"projects/irn-69801-billing-21/notificationChannels/6323446581XXXXXXXXX"}, "schemaVersion":"1.0"}, "thresholdRules":[]interface {}{map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.25}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.5}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.75}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":1}}}: timestamp=2021-06-25T16:02:14.391Z
2021-06-25T16:02:14.415Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:14 [DEBUG] Waiting for state to become: [success]: timestamp=2021-06-25T16:02:14.391Z
2021-06-25T16:02:14.415Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:14 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2021-06-25T16:02:14.391Z
2021-06-25T16:02:14.415Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:14 [DEBUG] Retry Transport: request attempt 0: timestamp=2021-06-25T16:02:14.391Z
2021-06-25T16:02:14.415Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:14 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
PATCH /v1/billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693?alt=json&updateMask=amount HTTP/1.1
Host: billingbudgets.googleapis.com
13.7 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.72.0
Content-Length: 616
Content-Type: application/json
Accept-Encoding: gzip
{
 "amount": {
  "specifiedAmount": {
   "currencyCode": "EUR",
   "units": "2000"
  }
 },
 "budgetFilter": {
  "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
  "projects": [
   "projects/567566XXXXXX"
  ]
 },
 "displayName": "IRN-69801",
 "notificationsRule": {
  "disableDefaultIamRecipients": true,
  "monitoringNotificationChannels": [
   "projects/irn-69801-billing-21/notificationChannels/6323446581XXXXXXXXX"
  ],
  "schemaVersion": "1.0"
 },
 "thresholdRules": [
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.25
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.5
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.75
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 1
  }
 ]
}
-----------------------------------------------------: timestamp=2021-06-25T16:02:14.392Z
2021-06-25T16:02:14.498Z [INFO]  plugin.terraform-provider-google-beta_v3.72.0_x5: 2021/06/25 16:02:14 [INFO] error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: googleapi: got HTTP response code 401 with body: {
  "error": "invalid_request",
  "error_description": "Invalid Credentials"
}: timestamp=2021-06-25T16:02:14.497Z
2021-06-25T16:02:14.498Z [INFO]  plugin.terraform-provider-google-beta_v3.72.0_x5: 2021/06/25 16:02:14 [INFO] Terraform is using this identity:: timestamp=2021-06-25T16:02:14.497Z
2021-06-25T16:02:14.505Z [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-06-25T16:02:14.509Z [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/hashicorp/google-beta/3.72.0/linux_amd64/terraform-provider-google-beta_v3.72.0_x5 pid=328
2021-06-25T16:02:14.509Z [DEBUG] plugin: plugin exited
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Jun 2021 16:02:16 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
{
  "name": "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693",
  "displayName": "IRN-69801",
  "budgetFilter": {
    "projects": [
"projects/567566XXXXXX"
    ],
    "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
    "calendarPeriod": "MONTH"
  },
  "amount": {
    "specifiedAmount": {
      "currencyCode": "EUR",
      "units": "5000"
    }
  },
  "thresholdRules": [
    {
      "thresholdPercent": 0.25,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.5,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.75,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 1,
      "spendBasis": "CURRENT_SPEND"
    }
  ],
  "notificationsRule": {
    "monitoringNotificationChannels": [
"projects/irn-69801-billing-21/notificationChannels/6323446581XXXXXXXXX"
    ],
    "disableDefaultIamRecipients": true
  },
  "etag": "1624636935936991"
}
-----------------------------------------------------: timestamp=2021-06-25T16:02:16.738Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Retry Transport: Stopping retries, last request was successful: timestamp=2021-06-25T16:02:16.738Z
mpts: timestamp=2021-06-25T16:02:16.738Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Finished updating Budget "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693": map[string]interface {}{"amount":map[string]interface {}{"specifiedAmount":map[string]interface {}{"currencyCode":"EUR", "units":"5000"}}, "budgetFilter":map[string]interface {}{"calendarPeriod":"MONTH", "creditTypesTreatment":"INCLUDE_ALL_CREDITS", "projects":[]interface {}{"projects/567566XXXXXX"}}, "displayName":"IRN-69801", "etag":"1624636935936991", "name":"billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693", "notificationsRule":map[string]interface {}{"disableDefaultIamRecipients":true, "monitoringNotificationChannels":[]interface {}{"projects/irn-69801-billing-21/notificationChannels/6323446581XXXXXXXXX"}}, "thresholdRules":[]interface {}{map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.25}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.5}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.75}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":1}}}: timestamp=2021-06-25T16:02:16.738Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Waiting for state to become: [success]: timestamp=2021-06-25T16:02:16.738Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2021-06-25T16:02:16.739Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Retry Transport: request attempt 0: timestamp=2021-06-25T16:02:16.739Z
2021-06-25T16:02:16.739Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:16 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
ounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693?alt=json HTTP/1.1
Host: billingbudgets.googleapis.com
User-Agent: Terraform/0.13.7 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.72.0
Content-Type: application/json
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2021-06-25T16:02:16.739Z
google_billing_budget.budget[0]: Modifications complete after 4s [id=billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693]
2021/06/25 16:02:17 [WARN] Provider "registry.terraform.io/hashicorp/google" produced an unexpected new value for google_billing_budget.budget[0], 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:
      - .amount[0].specified_amount[0].units: was cty.StringVal("2000"), but now cty.StringVal("5000")
2021-06-25T16:02:17.522Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:17 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Jun 2021 16:02:17 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
{
  "name": "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693",
  "displayName": "IRN-69801",
  "budgetFilter": {
    "projects": [
"projects/567566XXXXXX"
    ],
    "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
    "calendarPeriod": "MONTH"
  },
  "amount": {
    "specifiedAmount": {
      "currencyCode": "EUR",
      "units": "5000"
    }
  },
  "thresholdRules": [
    {
cent": 0.25,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.5,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.75,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 1,
      "spendBasis": "CURRENT_SPEND"
    }
  ],
  "notificationsRule": {
    "monitoringNotificationChannels": [
"projects/irn-69801-billing-21/notificationChannels/6323446581XXXXXXXXX"
    ],
    "disableDefaultIamRecipients": true
  },
  "etag": "1624636935936991"
}
-----------------------------------------------------: timestamp=2021-06-25T16:02:17.519Z
2021-06-25T16:02:17.522Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:17 [DEBUG] Retry Transport: Stopping retries, last request was successful: timestamp=2021-06-25T16:02:17.519Z
2021-06-25T16:02:17.522Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:17 [DEBUG] Retry Transport: Returning after 1 attempts: timestamp=2021-06-25T16:02:17.519Z
2021-06-25T16:02:17.532Z [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/hashicorp/google/3.72.0/linux_amd64/terraform-provider-google_v3.72.0_x5 pid=311
2021-06-25T16:02:17.532Z [DEBUG] plugin: plugin exited
2021-06-25T16:02:17.552Z [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
Warning: Deprecated Resource
The null_data_source was historically used to construct intermediate values to
re-use elsewhere in configuration, the same can now be achieved using locals
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Look at this line below, it's an extract of the logs

-----------------------------------------------------: timestamp=2021-06-25T16:02:16.739Z
google_billing_budget.budget[0]: Modifications complete after 4s [id=billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843ff693]
2021/06/25 16:02:17 [WARN] Provider "registry.terraform.io/hashicorp/google" produced an unexpected new value for google_billing_budget.budget[0], 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:
      - .amount[0].specified_amount[0].units: was cty.StringVal("2000"), but now cty.StringVal("5000")
2021-06-25T16:02:17.522Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 16:02:17 [DEBUG] Google API Response Details:
edwardmedia commented 3 years ago

@yassine-naamane I can't see anything wrong yet. The new amount 2000 was set in the PATCH request, but looks like API did not take the new value as it sent back with the original amount 5000 in the response.

Do you notice below error? Can you resolve this? In the meantimes, are you able to update the amount using other tools with the same user account?

2021-06-25T16:02:14.498Z [INFO]  plugin.terraform-provider-google-beta_v3.72.0_x5: 2021/06/25 16:02:14 [INFO] error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: googleapi: got HTTP response code 401 with body: {
  "error": "invalid_request",
  "error_description": "Invalid Credentials"
}: timestamp=2021-06-25T16:02:14.497Z
n-yassine commented 3 years ago

Hi @edwardmedia The error below is not normal, because I can create billing alerts with the same service account, and I can change values like the billing alert name

2:30 [INFO] error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: googleapi: got HTTP response code 401 with body: {
  "error": "invalid_request",
  "error_description": "Invalid Credentials"
}: timestamp=2021-06-25T17:32:30.181Z

As you can see in the log below: displayName": pass from "IRN-69801" to "Billing Alert Test"
But, it is not possible to modify the amount. So the error message is wrong

[DEBUG] Updating Budget "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX": map[string]interface {}{"amount":map[string]interface {}{"specifiedAmount":map[string]interface {}{"currencyCode":"EUR", "units":"2000"}}, "budgetFilter":map[string]interface {}{"creditTypesTreatment":"INCLUDE_ALL_CREDITS", "projects":[]interface {}{"projects/5675662XXXX"}}, "displayName":"Billing Alert Test", "notificationsRule":map[string]interface {}{"disableDefaultIamRecipients":true, "monitoringNotificationChannels":[]interface {}{"projects/irn-69801-billing-21/notificationChannels/632344658148226XXXX"}, "schemaVersion":"1.0"}, "thresholdRules":[]interface {}{map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.25}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.5}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.75}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":1}}}: timestamp=2021-06-25T17:32:51.924Z
2021-06-25T17:32:51.926Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:51 [DEBUG] Waiting for state to become: [success]: timestamp=2021-06-25T17:32:51.925Z
2021-06-25T17:32:51.926Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:51 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2021-06-25T17:32:51.925Z
2021-06-25T17:32:51.926Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:51 [DEBUG] Retry Transport: request attempt 0: timestamp=2021-06-25T17:32:51.925Z
2021-06-25T17:32:51.926Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:51 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
PATCH /v1/billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX?alt=json&updateMask=displayName%2Camount HTTP/1.1
Host: billingbudgets.googleapis.com
ser-Agent: Terraform/0.13.7 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.72.0
Content-Length: 625
Content-Type: application/json
Accept-Encoding: gzip
{
 "amount": {
  "specifiedAmount": {
   "currencyCode": "EUR",
   "units": "2000"
  }
 },
 "budgetFilter": {
  "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
  "projects": [
   "projects/5675662XXXX"
  ]
 },
 "displayName": "Billing Alert Test",
 "notificationsRule": {
  "disableDefaultIamRecipients": true,
  "monitoringNotificationChannels": [
   "projects/irn-69801-billing-21/notificationChannels/632344658148226XXXX"
  ],
  "schemaVersion": "1.0"
 },
 "thresholdRules": [
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.25
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.5
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 0.75
  },
  {
   "spendBasis": "CURRENT_SPEND",
   "thresholdPercent": 1
  }
 ]
}
-----------------------------------------------------: timestamp=2021-06-25T17:32:51.925Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Jun 2021 17:32:54 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
{
  "name": "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX",
  "displayName": "Billing Alert Test",
  "budgetFilter": {
    "projects": [
"projects/5675662XXXX"
    ],
    "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
    "calendarPeriod": "MONTH"
  },
  "amount": {
    "specifiedAmount": {
      "currencyCode": "EUR",
      "units": "5000"
    }
  },
  "thresholdRules": [
    {
      "thresholdPercent": 0.25,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.5,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.75,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 1,
      "spendBasis": "CURRENT_SPEND"
    }
  ],
  "notificationsRule": {
    "monitoringNotificationChannels": [
"projects/irn-69801-billing-21/notificationChannels/632344658148226XXXX"
    ],
    "disableDefaultIamRecipients": true
  },
  "etag": "1624642373589816"
}
-----------------------------------------------------: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Retry Transport: Stopping retries, last request was successful: timestamp=2021-06-25T17:32:54.365Z
er 1 attempts: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Finished updating Budget "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX": map[string]interface {}{"amount":map[string]interface {}{"specifiedAmount":map[string]interface {}{"currencyCode":"EUR", "units":"5000"}}, "budgetFilter":map[string]interface {}{"calendarPeriod":"MONTH", "creditTypesTreatment":"INCLUDE_ALL_CREDITS", "projects":[]interface {}{"projects/5675662XXXX"}}, "displayName":"Billing Alert Test", "etag":"1624642373589816", "name":"billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX", "notificationsRule":map[string]interface {}{"disableDefaultIamRecipients":true, "monitoringNotificationChannels":[]interface {}{"projects/irn-69801-billing-21/notificationChannels/632344658148226XXXX"}}, "thresholdRules":[]interface {}{map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.25}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.5}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":0.75}, map[string]interface {}{"spendBasis":"CURRENT_SPEND", "thresholdPercent":1}}}: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Waiting for state to become: [success]: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Retry Transport: starting RoundTrip retry loop: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Retry Transport: request attempt 0: timestamp=2021-06-25T17:32:54.365Z
2021-06-25T17:32:54.366Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:54 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1/billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX?alt=json HTTP/1.1
Host: billingbudgets.googleapis.com
User-Agent: Terraform/0.13.7 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.72.0
Content-Type: application/json
Accept-Encoding: gzip
-----------------------------------------------------: timestamp=2021-06-25T17:32:54.365Z
google_billing_budget.budget[0]: Modifications complete after 3s [id=billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX]
2021/06/25 17:32:55 [WARN] Provider "registry.terraform.io/hashicorp/google" produced an unexpected new value for google_billing_budget.budget[0], 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:
      - .amount[0].specified_amount[0].units: was cty.StringVal("2000"), but now cty.StringVal("5000")
2021-06-25T17:32:55.152Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:55 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Jun 2021 17:32:55 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0
{
  "name": "billingAccounts/01D737-CD1044-XXXXXX/budgets/c94a583e-c984-41b0-887f-cd07843XXXXX",
  "displayName": "Billing Alert Test",
  "budgetFilter": {
    "projects": [
"projects/5675662XXXX"
    ],
    "creditTypesTreatment": "INCLUDE_ALL_CREDITS",
    "calendarPeriod": "MONTH"
  },
  "amount": {
    "specifiedAmount": {
      "currencyCode": "EUR",
      "units": "5000"
    }
  },
  "thresholdRules": [
    {
esholdPercent": 0.25,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.5,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 0.75,
      "spendBasis": "CURRENT_SPEND"
    },
    {
      "thresholdPercent": 1,
      "spendBasis": "CURRENT_SPEND"
    }
  ],
  "notificationsRule": {
    "monitoringNotificationChannels": [
"projects/irn-69801-billing-21/notificationChannels/632344658148226XXXX"
    ],
    "disableDefaultIamRecipients": true
  },
  "etag": "1624642373589816"
}
-----------------------------------------------------: timestamp=2021-06-25T17:32:55.150Z
2021-06-25T17:32:55.152Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:55 [DEBUG] Retry Transport: Stopping retries, last request was successful: timestamp=2021-06-25T17:32:55.150Z
2021-06-25T17:32:55.152Z [INFO]  plugin.terraform-provider-google_v3.72.0_x5: 2021/06/25 17:32:55 [DEBUG] Retry Transport: Returning after 1 attempts: timestamp=2021-06-25T17:32:55.150Z
2021-06-25T17:32:55.165Z [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/hashicorp/google/3.72.0/linux_amd64/terraform-provider-google_v3.72.0_x5 pid=329
2021-06-25T17:32:55.165Z [DEBUG] plugin: plugin exited
2021-06-25T17:32:55.182Z [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
adziura-tcloud commented 3 years ago

Confirming same behavior. Starts from provider version 3.67.0.

n-yassine commented 3 years ago

Hi @adziura-tcloud @edwardmedia

I did the same test with an another version of provider ( v3.56.0) and I confirm that it works.

It is a regression in the new versions of the provider > 3.56.0

Regards Yassine

adziura-tcloud commented 3 years ago

@yassine-naamane Have you experienced problems with provider version? Error: Resource instance managed by newer provider version

n-yassine commented 3 years ago

@adziura-tcloud

Indeed, I had to delete first, the resources with the same version of the provider (3.72.0) and then I recreated them again with an old version (3.56.0) And this allowed me to move forward

Regards Yassine

edwardmedia commented 3 years ago

@melinath could this be related to below PR?

https://github.com/hashicorp/terraform-provider-google/pull/8990

github-actions[bot] commented 3 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 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.