Skip to content

Commit

Permalink
Made google_billing_budget.all_updates_rule subfields get updated (#4933
Browse files Browse the repository at this point in the history
)

This is a follow-up for #4929, which fixed this issue for `amount` and its subfields
  • Loading branch information
melinath authored Jun 30, 2021
1 parent a4ba710 commit 22f591b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
6 changes: 6 additions & 0 deletions mmv1/products/billingbudget/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ overrides: !ruby/object:Overrides::ResourceOverrides
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
allUpdatesRule: !ruby/object:Overrides::Terraform::PropertyOverride
update_mask_fields:
- "notificationsRule.pubsubTopic"
- "notificationsRule.schemaVersion"
- "notificationsRule.monitoringNotificationChannels"
- "notificationsRule.disableDefaultIamRecipients"
allUpdatesRule.schemaVersion: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: templates/terraform/custom_flatten/default_if_empty.erb
amount: !ruby/object:Overrides::Terraform::PropertyOverride
Expand Down
35 changes: 33 additions & 2 deletions mmv1/third_party/terraform/tests/resource_billing_budget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestAccBillingBudget_billingBudgetUpdate(t *testing.T) {
ImportStateVerify: true,
},
{
Config: testAccBillingBudget_billingBudgetUpdateChangeAmount(context),
Config: testAccBillingBudget_billingBudgetUpdate(context),
},
{
ResourceName: "google_billing_budget.budget",
Expand All @@ -105,6 +105,13 @@ func TestAccBillingBudget_billingBudgetUpdate(t *testing.T) {

func testAccBillingBudget_billingBudgetUpdateStart(context map[string]interface{}) string {
return Nprintf(`
resource "google_pubsub_topic" "topic1" {
name = "tf-test-billing-budget1-%{random_suffix}"
}
resource "google_pubsub_topic" "topic2" {
name = "tf-test-billing-budget2-%{random_suffix}"
}
data "google_billing_account" "account" {
billing_account = "%{billing_acct}"
}
Expand Down Expand Up @@ -134,12 +141,22 @@ resource "google_billing_budget" "budget" {
threshold_percent = 0.9
spend_basis = "FORECASTED_SPEND"
}
all_updates_rule {
pubsub_topic = google_pubsub_topic.topic1.id
}
}
`, context)
}

func testAccBillingBudget_billingBudgetUpdateRemoveFilter(context map[string]interface{}) string {
return Nprintf(`
resource "google_pubsub_topic" "topic1" {
name = "tf-test-billing-budget1-%{random_suffix}"
}
resource "google_pubsub_topic" "topic2" {
name = "tf-test-billing-budget2-%{random_suffix}"
}
data "google_billing_account" "account" {
billing_account = "%{billing_acct}"
}
Expand Down Expand Up @@ -169,12 +186,22 @@ resource "google_billing_budget" "budget" {
threshold_percent = 0.9
spend_basis = "FORECASTED_SPEND"
}
all_updates_rule {
pubsub_topic = google_pubsub_topic.topic1.id
}
}
`, context)
}

func testAccBillingBudget_billingBudgetUpdateChangeAmount(context map[string]interface{}) string {
func testAccBillingBudget_billingBudgetUpdate(context map[string]interface{}) string {
return Nprintf(`
resource "google_pubsub_topic" "topic1" {
name = "tf-test-billing-budget1-%{random_suffix}"
}
resource "google_pubsub_topic" "topic2" {
name = "tf-test-billing-budget2-%{random_suffix}"
}
data "google_billing_account" "account" {
billing_account = "%{billing_acct}"
}
Expand Down Expand Up @@ -204,6 +231,10 @@ resource "google_billing_budget" "budget" {
threshold_percent = 0.9
spend_basis = "FORECASTED_SPEND"
}
all_updates_rule {
pubsub_topic = google_pubsub_topic.topic2.id
}
}
`, context)
}
Expand Down

0 comments on commit 22f591b

Please sign in to comment.