Skip to content

Commit 5c372ab

Browse files
ewbankkitrosbo
authored andcommitted
Add 'google_billing_account' data source (hashicorp#889)
* Add 'google_billing_account' data source. * Use 'GetResourceNameFromSelfLink'. * Use 'ConflictsWith' in schema. * Use pagination for List() API call. * Add ability to filter by 'open' attribute. * Don't use 'ForceNew' for data sources. * Add 'billing_account' argument and make 'name' an output-only attribute. * Correct error message.
1 parent edc06db commit 5c372ab

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_billing_account"
4+
sidebar_current: "docs-google-datasource-billing-account"
5+
description: |-
6+
Get information about a Google Billing Account.
7+
---
8+
9+
# google\_billing\_account
10+
11+
Use this data source to get information about a Google Billing Account.
12+
13+
```hcl
14+
data "google_billing_account" "acct" {
15+
display_name = "My Billing Account"
16+
open = true
17+
}
18+
19+
resource "google_project" "my_project" {
20+
name = "My Project"
21+
project_id = "your-project-id"
22+
org_id = "1234567"
23+
24+
billing_account = "${data.google_billing_account.acct.id}"
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The arguments of this data source act as filters for querying the available billing accounts.
31+
The given filters must match exactly one billing account whose data will be exported as attributes.
32+
The following arguments are supported:
33+
34+
* `billing_account` (Optional) - The name of the billing account in the form `{billing_account_id}` or `billingAccounts/{billing_account_id}`.
35+
* `display_name` (Optional) - The display name of the billing account.
36+
* `open` (Optional) - `true` if the billing account is open, `false` if the billing account is closed.
37+
38+
~> **NOTE:** One of `billing_account` or `display_name` must be specified.
39+
40+
## Attributes Reference
41+
42+
The following additional attributes are exported:
43+
44+
* `id` - The billing account ID.
45+
* `name` - The resource name of the billing account in the form `billingAccounts/{billing_account_id}`.
46+
* `project_ids` - The IDs of any projects associated with the billing account.

google.erb

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<li<%= sidebar_current("docs-google-datasource") %>>
1414
<a href="#">Google Cloud Platform Data Sources</a>
1515
<ul class="nav nav-visible">
16+
<li<%= sidebar_current("docs-google-datasource-billing-account") %>>
17+
<a href="/docs/providers/google/d/google_billing_account.html">google_billing_account</a>
18+
</li>
1619
<li<%= sidebar_current("docs-google-datasource-client-config") %>>
1720
<a href="/docs/providers/google/d/datasource_client_config.html">google_client_config</a>
1821
</li>
@@ -136,7 +139,7 @@
136139
</li>
137140
<li<%= sidebar_current("docs-google-service-account") %>>
138141
<a href="/docs/providers/google/r/google_service_account.html">google_service_account</a>
139-
</li>
142+
</li>
140143
<li<%= sidebar_current("docs-google-service-account-iam") %>>
141144
<a href="/docs/providers/google/r/google_service_account_iam.html">google_service_account_iam_binding</a>
142145
</li>

0 commit comments

Comments
 (0)