gcp.organizations.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
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,
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,
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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:organizations/getBillingAccount:getBillingAccount
arguments:
# arguments dictionary
The 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.
- Open bool
true
if the billing account is open,false
if 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.
- Open bool
true
if the billing account is open,false
if 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.
- open Boolean
true
if the billing account is open,false
if 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.
- 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}
orbillingAccounts/{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.
- 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.
- open Boolean
true
if the billing account is open,false
if 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.
- Billing
Account string
- 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.
- Billing
Account string
- 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.
- billing
Account String
- 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.
- billing
Account 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
- 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.
- billing
Account String
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.