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 System.Collections.Generic;
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("myProject", new()
{
ProjectId = "your-project-id",
OrgId = "1234567",
BillingAccount = acct.Apply(getBillingAccountResult => getBillingAccountResult.Id),
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/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, "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
})
}
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()
.projectId("your-project-id")
.orgId("1234567")
.billingAccount(acct.applyValue(getBillingAccountResult -> getBillingAccountResult.id()))
.build());
}
}
resources:
myProject:
type: gcp:organizations:Project
properties:
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, open: Boolean? = null): GetBillingAccountResult

Return

A collection of values returned by getBillingAccount.

See also

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.

open

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


Return

A collection of values returned by getBillingAccount.

See also

Parameters

argument

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