gcp.organizations.getBillingAccount
Explore with Pulumi AI
Use this data source to get information about a Google Billing Account.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const acct = gcp.organizations.getBillingAccount({
displayName: "My Billing Account",
open: true,
});
const myProject = new gcp.organizations.Project("my_project", {
name: "My Project",
projectId: "your-project-id",
orgId: "1234567",
billingAccount: acct.then(acct => acct.id),
});
import pulumi
import pulumi_gcp as gcp
acct = gcp.organizations.get_billing_account(display_name="My Billing Account",
open=True)
my_project = gcp.organizations.Project("my_project",
name="My Project",
project_id="your-project-id",
org_id="1234567",
billing_account=acct.id)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
acct, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
DisplayName: pulumi.StringRef("My Billing Account"),
Open: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
_, err = organizations.NewProject(ctx, "my_project", &organizations.ProjectArgs{
Name: pulumi.String("My Project"),
ProjectId: pulumi.String("your-project-id"),
OrgId: pulumi.String("1234567"),
BillingAccount: pulumi.String(acct.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var acct = Gcp.Organizations.GetBillingAccount.Invoke(new()
{
DisplayName = "My Billing Account",
Open = true,
});
var myProject = new Gcp.Organizations.Project("my_project", new()
{
Name = "My Project",
ProjectId = "your-project-id",
OrgId = "1234567",
BillingAccount = acct.Apply(getBillingAccountResult => getBillingAccountResult.Id),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetBillingAccountArgs;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var acct = OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
.displayName("My Billing Account")
.open(true)
.build());
var myProject = new Project("myProject", ProjectArgs.builder()
.name("My Project")
.projectId("your-project-id")
.orgId("1234567")
.billingAccount(acct.id())
.build());
}
}
resources:
myProject:
type: gcp:organizations:Project
name: my_project
properties:
name: My Project
projectId: your-project-id
orgId: '1234567'
billingAccount: ${acct.id}
variables:
acct:
fn::invoke:
function: gcp:organizations:getBillingAccount
arguments:
displayName: My Billing Account
open: true
Using getBillingAccount
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getBillingAccount(args: GetBillingAccountArgs, opts?: InvokeOptions): Promise<GetBillingAccountResult>
function getBillingAccountOutput(args: GetBillingAccountOutputArgs, opts?: InvokeOptions): Output<GetBillingAccountResult>def get_billing_account(billing_account: Optional[str] = None,
display_name: Optional[str] = None,
lookup_projects: Optional[bool] = None,
open: Optional[bool] = None,
opts: Optional[InvokeOptions] = None) -> GetBillingAccountResult
def get_billing_account_output(billing_account: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
lookup_projects: Optional[pulumi.Input[bool]] = None,
open: Optional[pulumi.Input[bool]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetBillingAccountResult]func GetBillingAccount(ctx *Context, args *GetBillingAccountArgs, opts ...InvokeOption) (*GetBillingAccountResult, error)
func GetBillingAccountOutput(ctx *Context, args *GetBillingAccountOutputArgs, opts ...InvokeOption) GetBillingAccountResultOutput> Note: This function is named GetBillingAccount in the Go SDK.
public static class GetBillingAccount
{
public static Task<GetBillingAccountResult> InvokeAsync(GetBillingAccountArgs args, InvokeOptions? opts = null)
public static Output<GetBillingAccountResult> Invoke(GetBillingAccountInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetBillingAccountResult> getBillingAccount(GetBillingAccountArgs args, InvokeOptions options)
public static Output<GetBillingAccountResult> getBillingAccount(GetBillingAccountArgs args, InvokeOptions options)
fn::invoke:
function: gcp:organizations/getBillingAccount:getBillingAccount
arguments:
# arguments dictionaryThe following arguments are supported:
- Billing
Account string - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - Display
Name string - The display name of the billing account.
- Lookup
Projects bool trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- Open bool
trueif the billing account is open,falseif the billing account is closed.
- Billing
Account string - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - Display
Name string - The display name of the billing account.
- Lookup
Projects bool trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- Open bool
trueif the billing account is open,falseif the billing account is closed.
- billing
Account String - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - display
Name String - The display name of the billing account.
- lookup
Projects Boolean trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- open Boolean
trueif the billing account is open,falseif the billing account is closed.
- billing
Account string - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - display
Name string - The display name of the billing account.
- lookup
Projects boolean trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- open boolean
trueif the billing account is open,falseif the billing account is closed.
- billing_
account str - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - display_
name str - The display name of the billing account.
- lookup_
projects bool trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- open bool
trueif the billing account is open,falseif the billing account is closed.
- billing
Account String - The name of the billing account in the form
{billing_account_id}orbillingAccounts/{billing_account_id}. - display
Name String - The display name of the billing account.
- lookup
Projects Boolean trueif projects associated with the billing account should be read,falseif this step should be skipped. Settingfalsemay be useful if the user permissions do not allow listing projects. Defaults totrue.NOTE: One of
billing_accountordisplay_namemust be specified.- open Boolean
trueif the billing account is open,falseif the billing account is closed.
getBillingAccount Result
The following output properties are available:
- Display
Name string - Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - Open bool
- Project
Ids List<string> - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - Billing
Account string - Lookup
Projects bool
- Display
Name string - Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - Open bool
- Project
Ids []string - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - Billing
Account string - Lookup
Projects bool
- display
Name String - id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - open Boolean
- project
Ids List<String> - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - billing
Account String - lookup
Projects Boolean
- display
Name string - id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - open boolean
- project
Ids string[] - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - billing
Account string - lookup
Projects boolean
- display_
name str - id str
- The provider-assigned unique ID for this managed resource.
- name str
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - open bool
- project_
ids Sequence[str] - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - billing_
account str - lookup_
projects bool
- display
Name String - id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the billing account in the form
billingAccounts/{billing_account_id}. - open Boolean
- project
Ids List<String> - The IDs of any projects associated with the billing account.
lookup_projectsmust not be false for this to be populated. - billing
Account String - lookup
Projects Boolean
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.