Skip to content

Commit a69ffdf

Browse files
billing: added currency_code to google_billing_account data source (#14301) (#23474)
[upstream:c8737a21045aa53dde90009837a5c29d4cfacb84] Signed-off-by: Modular Magician <[email protected]>
1 parent 89e6a5f commit a69ffdf

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

.changelog/14301.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
billing: added `currency_code` to `google_billing_account` data source
3+
```

google/services/billing/data_source_google_billing_account.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func DataSourceGoogleBillingAccount() *schema.Resource {
6363
Optional: true,
6464
Default: true,
6565
},
66+
"currency_code": {
67+
Type: schema.TypeString,
68+
Computed: true,
69+
},
6670
},
6771
}
6872
}
@@ -141,6 +145,9 @@ func dataSourceBillingAccountRead(d *schema.ResourceData, meta interface{}) erro
141145
if err := d.Set("open", billingAccount.Open); err != nil {
142146
return fmt.Errorf("Error setting open: %s", err)
143147
}
148+
if err := d.Set("currency_code", billingAccount.CurrencyCode); err != nil {
149+
return fmt.Errorf("Error setting currency_code: %s", err)
150+
}
144151

145152
return nil
146153
}

google/services/billing/data_source_google_billing_account_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func TestAccDataSourceGoogleBillingAccount_byShortName(t *testing.T) {
6060
resource.TestCheckResourceAttr("data.google_billing_account.acct", "id", billingId),
6161
resource.TestCheckResourceAttr("data.google_billing_account.acct", "name", name),
6262
resource.TestCheckResourceAttr("data.google_billing_account.acct", "open", "true"),
63+
resource.TestCheckResourceAttrSet("data.google_billing_account.acct", "currency_code"),
6364
),
6465
},
6566
},

website/docs/d/billing_account.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ The following additional attributes are exported:
5959
* `name` - The resource name of the billing account in the form `billingAccounts/{billing_account_id}`.
6060
* `project_ids` - The IDs of any projects associated with the billing account. `lookup_projects` must not be false
6161
for this to be populated.
62+
* `currency_code` - The currency code of the billing account, e.g. `USD`.

0 commit comments

Comments
 (0)