From e6a48ef59bb208c53b2239b033138741dd4d0611 Mon Sep 17 00:00:00 2001 From: Umair Idris Date: Wed, 27 Nov 2019 16:11:33 +0000 Subject: [PATCH] add at_least_one_of to budget filter, add filter test --- products/billingbudget/api.yaml | 4 ++++ products/billingbudget/terraform.yaml | 8 ++++++++ templates/terraform/examples/billing_budget_filter.tf.erb | 3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/products/billingbudget/api.yaml b/products/billingbudget/api.yaml index da0bb04ff30e..51f200e779e1 100644 --- a/products/billingbudget/api.yaml +++ b/products/billingbudget/api.yaml @@ -71,6 +71,10 @@ objects: description: | Filters that define which resources are used to compute the actual spend against the budget. + at_least_one_of: + - budget_filter.0.projects + - budget_filter.0.credit_types_treatment + - budget_filter.0.services properties: - !ruby/object:Api::Type::Array name: projects diff --git a/products/billingbudget/terraform.yaml b/products/billingbudget/terraform.yaml index bffdd96995e8..02e956d4106b 100644 --- a/products/billingbudget/terraform.yaml +++ b/products/billingbudget/terraform.yaml @@ -25,6 +25,14 @@ overrides: !ruby/object:Overrides::ResourceOverrides display_name: 'Example Billing Budget' test_env_vars: billing_acct: :BILLING_ACCT + - !ruby/object:Provider::Terraform::Examples + name: 'billing_budget_filter' + min_version: beta + primary_resource_id: 'budget' + vars: + display_name: 'Example Billing Budget' + test_env_vars: + billing_acct: :BILLING_ACCT custom_code: !ruby/object:Provider::Terraform::CustomCode custom_import: templates/terraform/custom_import/self_link_as_name.erb post_create: templates/terraform/post_create/set_computed_name.erb diff --git a/templates/terraform/examples/billing_budget_filter.tf.erb b/templates/terraform/examples/billing_budget_filter.tf.erb index eee5be01d81d..c920c940a798 100644 --- a/templates/terraform/examples/billing_budget_filter.tf.erb +++ b/templates/terraform/examples/billing_budget_filter.tf.erb @@ -1,6 +1,5 @@ data "google_billing_account" "account" { - display_name = "My Billing Account" - open = true + billing_account = "<%= ctx[:test_env_vars]['billing_acct'] -%>" } resource "google_billing_budget" "<%= ctx[:primary_resource_id] %>" {