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.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
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:
- BillingAccount string
- The name of the billing account in the form {billing_account_id}orbillingAccounts/{billing_account_id}.
- DisplayName string
- The display name of the billing account.
- LookupProjects bool
- trueif projects associated with the billing account should be read,- falseif this step should be skipped. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_namemust be specified.
- Open bool
- trueif the billing account is open,- falseif the billing account is closed.
- BillingAccount string
- The name of the billing account in the form {billing_account_id}orbillingAccounts/{billing_account_id}.
- DisplayName string
- The display name of the billing account.
- LookupProjects bool
- trueif projects associated with the billing account should be read,- falseif this step should be skipped. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_namemust be specified.
- Open bool
- trueif the billing account is open,- falseif the billing account is closed.
- billingAccount String
- The name of the billing account in the form {billing_account_id}orbillingAccounts/{billing_account_id}.
- displayName String
- The display name of the billing account.
- lookupProjects Boolean
- trueif projects associated with the billing account should be read,- falseif this step should be skipped. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_namemust be specified.
- open Boolean
- trueif the billing account is open,- falseif the billing account is closed.
- billingAccount string
- The name of the billing account in the form {billing_account_id}orbillingAccounts/{billing_account_id}.
- displayName string
- The display name of the billing account.
- lookupProjects boolean
- trueif projects associated with the billing account should be read,- falseif this step should be skipped. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_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. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_namemust be specified.
- open bool
- trueif the billing account is open,- falseif the billing account is closed.
- billingAccount String
- The name of the billing account in the form {billing_account_id}orbillingAccounts/{billing_account_id}.
- displayName String
- The display name of the billing account.
- lookupProjects Boolean
- trueif projects associated with the billing account should be read,- falseif this step should be skipped. Setting- falsemay be useful if the user permissions do not allow listing projects. Defaults to- true.- NOTE: One of - billing_accountor- display_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:
- 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. lookup_projectsmust not be false for this to be populated.
- BillingAccount string
- LookupProjects bool
- 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. lookup_projectsmust not be false for this to be populated.
- BillingAccount string
- LookupProjects bool
- 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 List<String>
- The IDs of any projects associated with the billing account. lookup_projectsmust not be false for this to be populated.
- billingAccount String
- lookupProjects Boolean
- 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. lookup_projectsmust not be false for this to be populated.
- billingAccount string
- lookupProjects 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
- 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 List<String>
- The IDs of any projects associated with the billing account. lookup_projectsmust not be false for this to be populated.
- billingAccount String
- lookupProjects 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.