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("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)
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 main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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
})
}
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.applyValue(getBillingAccountResult -> getBillingAccountResult.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

Return

A collection of values returned by getBillingAccount.

Parameters

argument

A collection of arguments for invoking getBillingAccount.


suspend fun getBillingAccount(billingAccount: String? = null, displayName: String? = null, lookupProjects: Boolean? = null, open: Boolean? = null): GetBillingAccountResult

Return

A collection of values returned by getBillingAccount.

Parameters

billingAccount

The name of the billing account in the form {billing_account_id} or billingAccounts/{billing_account_id}.

displayName

The display name of the billing account.

lookupProjects

true if projects associated with the billing account should be read, false if this step should be skipped. Setting false may be useful if the user permissions do not allow listing projects. Defaults to true.

NOTE: One of billing_account or display_name must be specified.

open

true if the billing account is open, false if the billing account is closed.

See also


Return

A collection of values returned by getBillingAccount.

Parameters

argument

Builder for com.pulumi.gcp.organizations.kotlin.inputs.GetBillingAccountPlainArgs.

See also