getBillingAccount

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("myProject", {
    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("myProject",
    project_id="your-project-id",
    org_id="1234567",
    billing_account=acct.id)
using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var acct = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
        {
            DisplayName = "My Billing Account",
            Open = true,
        }));
        var myProject = new Gcp.Organizations.Project("myProject", new Gcp.Organizations.ProjectArgs
        {
            ProjectId = "your-project-id",
            OrgId = "1234567",
            BillingAccount = acct.Apply(acct => acct.Id),
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "My Billing Account"
		opt1 := true
		acct, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
			DisplayName: &opt0,
			Open:        &opt1,
		}, nil)
		if err != nil {
			return err
		}
		_, err = organizations.NewProject(ctx, "myProject", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("your-project-id"),
			OrgId:          pulumi.String("1234567"),
			BillingAccount: pulumi.String(acct.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Using getBillingAccount

function getBillingAccount(args: GetBillingAccountArgs, opts?: InvokeOptions): Promise<GetBillingAccountResult>
def get_billing_account(billing_account: Optional[str] = None,
                        display_name: Optional[str] = None,
                        open: Optional[bool] = None,
                        opts: Optional[InvokeOptions] = None) -> GetBillingAccountResult
func GetBillingAccount(ctx *Context, args *GetBillingAccountArgs, opts ...InvokeOption) (*GetBillingAccountResult, error)

Note: This function is named GetBillingAccount in the Go SDK.

public static class GetBillingAccount {
    public static Task<GetBillingAccountResult> InvokeAsync(GetBillingAccountArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

BillingAccount string
The name of the billing account in the form {billing_account_id} or billingAccounts/{billing_account_id}.
DisplayName string
The display name of the billing account.
Open bool
true if the billing account is open, false if the billing account is closed.
BillingAccount string
The name of the billing account in the form {billing_account_id} or billingAccounts/{billing_account_id}.
DisplayName string
The display name of the billing account.
Open bool
true if the billing account is open, false if the billing account is closed.
billingAccount string
The name of the billing account in the form {billing_account_id} or billingAccounts/{billing_account_id}.
displayName string
The display name of the billing account.
open boolean
true if the billing account is open, false if the billing account is closed.
billing_account str
The name of the billing account in the form {billing_account_id} or billingAccounts/{billing_account_id}.
display_name str
The display name of the billing account.
open bool
true if the billing account is open, false if the billing account is closed.

getBillingAccount Result

The following output properties are available:

DisplayName 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
ProjectIds List<string>
The IDs of any projects associated with the billing account.
BillingAccount string
DisplayName 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
ProjectIds []string
The IDs of any projects associated with the billing account.
BillingAccount string
displayName 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
projectIds string[]
The IDs of any projects associated with the billing account.
billingAccount string
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.
billing_account str

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.