1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. billing
  5. SubAccount
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.billing.SubAccount

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Allows creation and management of a Google Cloud Billing Subaccount.

    !> WARNING: Deleting this resource will not delete or close the billing subaccount.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const subaccount = new gcp.billing.SubAccount("subaccount", {
        displayName: "My Billing Account",
        masterBillingAccount: "012345-567890-ABCDEF",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    subaccount = gcp.billing.SubAccount("subaccount",
        display_name="My Billing Account",
        master_billing_account="012345-567890-ABCDEF")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/billing"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := billing.NewSubAccount(ctx, "subaccount", &billing.SubAccountArgs{
    			DisplayName:          pulumi.String("My Billing Account"),
    			MasterBillingAccount: pulumi.String("012345-567890-ABCDEF"),
    		})
    		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 subaccount = new Gcp.Billing.SubAccount("subaccount", new()
        {
            DisplayName = "My Billing Account",
            MasterBillingAccount = "012345-567890-ABCDEF",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.billing.SubAccount;
    import com.pulumi.gcp.billing.SubAccountArgs;
    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) {
            var subaccount = new SubAccount("subaccount", SubAccountArgs.builder()
                .displayName("My Billing Account")
                .masterBillingAccount("012345-567890-ABCDEF")
                .build());
    
        }
    }
    
    resources:
      subaccount:
        type: gcp:billing:SubAccount
        properties:
          displayName: My Billing Account
          masterBillingAccount: 012345-567890-ABCDEF
    

    Create SubAccount Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SubAccount(name: string, args: SubAccountArgs, opts?: CustomResourceOptions);
    @overload
    def SubAccount(resource_name: str,
                   args: SubAccountArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def SubAccount(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   display_name: Optional[str] = None,
                   master_billing_account: Optional[str] = None,
                   deletion_policy: Optional[str] = None)
    func NewSubAccount(ctx *Context, name string, args SubAccountArgs, opts ...ResourceOption) (*SubAccount, error)
    public SubAccount(string name, SubAccountArgs args, CustomResourceOptions? opts = null)
    public SubAccount(String name, SubAccountArgs args)
    public SubAccount(String name, SubAccountArgs args, CustomResourceOptions options)
    
    type: gcp:billing:SubAccount
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SubAccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SubAccountArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SubAccountArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SubAccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SubAccountArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var subAccountResource = new Gcp.Billing.SubAccount("subAccountResource", new()
    {
        DisplayName = "string",
        MasterBillingAccount = "string",
        DeletionPolicy = "string",
    });
    
    example, err := billing.NewSubAccount(ctx, "subAccountResource", &billing.SubAccountArgs{
    	DisplayName:          pulumi.String("string"),
    	MasterBillingAccount: pulumi.String("string"),
    	DeletionPolicy:       pulumi.String("string"),
    })
    
    var subAccountResource = new SubAccount("subAccountResource", SubAccountArgs.builder()
        .displayName("string")
        .masterBillingAccount("string")
        .deletionPolicy("string")
        .build());
    
    sub_account_resource = gcp.billing.SubAccount("subAccountResource",
        display_name="string",
        master_billing_account="string",
        deletion_policy="string")
    
    const subAccountResource = new gcp.billing.SubAccount("subAccountResource", {
        displayName: "string",
        masterBillingAccount: "string",
        deletionPolicy: "string",
    });
    
    type: gcp:billing:SubAccount
    properties:
        deletionPolicy: string
        displayName: string
        masterBillingAccount: string
    

    SubAccount Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SubAccount resource accepts the following input properties:

    DisplayName string
    The display name of the billing account.
    MasterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    DeletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    DisplayName string
    The display name of the billing account.
    MasterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    DeletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName String
    The display name of the billing account.
    masterBillingAccount String
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    deletionPolicy String
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName string
    The display name of the billing account.
    masterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    deletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    display_name str
    The display name of the billing account.
    master_billing_account str
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    deletion_policy str
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName String
    The display name of the billing account.
    masterBillingAccount String
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    deletionPolicy String
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SubAccount resource produces the following output properties:

    BillingAccountId string
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.
    BillingAccountId string
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.
    billingAccountId String
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.
    billingAccountId string
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.
    billing_account_id str
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.
    billingAccountId String
    The billing account id.
    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
    true if the billing account is open, false if the billing account is closed.

    Look up Existing SubAccount Resource

    Get an existing SubAccount resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SubAccountState, opts?: CustomResourceOptions): SubAccount
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            billing_account_id: Optional[str] = None,
            deletion_policy: Optional[str] = None,
            display_name: Optional[str] = None,
            master_billing_account: Optional[str] = None,
            name: Optional[str] = None,
            open: Optional[bool] = None) -> SubAccount
    func GetSubAccount(ctx *Context, name string, id IDInput, state *SubAccountState, opts ...ResourceOption) (*SubAccount, error)
    public static SubAccount Get(string name, Input<string> id, SubAccountState? state, CustomResourceOptions? opts = null)
    public static SubAccount get(String name, Output<String> id, SubAccountState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BillingAccountId string
    The billing account id.
    DeletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    DisplayName string
    The display name of the billing account.
    MasterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    Name string
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    Open bool
    true if the billing account is open, false if the billing account is closed.
    BillingAccountId string
    The billing account id.
    DeletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    DisplayName string
    The display name of the billing account.
    MasterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    Name string
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    Open bool
    true if the billing account is open, false if the billing account is closed.
    billingAccountId String
    The billing account id.
    deletionPolicy String
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName String
    The display name of the billing account.
    masterBillingAccount String
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    name String
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    open Boolean
    true if the billing account is open, false if the billing account is closed.
    billingAccountId string
    The billing account id.
    deletionPolicy string
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName string
    The display name of the billing account.
    masterBillingAccount string
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    name string
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    open boolean
    true if the billing account is open, false if the billing account is closed.
    billing_account_id str
    The billing account id.
    deletion_policy str
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    display_name str
    The display name of the billing account.
    master_billing_account str
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    name str
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    open bool
    true if the billing account is open, false if the billing account is closed.
    billingAccountId String
    The billing account id.
    deletionPolicy String
    If set to "RENAME_ON_DESTROY" the billing account display_name will be changed to "Destroyed" along with a timestamp. If set to "" this will not occur. Default is "".
    displayName String
    The display name of the billing account.
    masterBillingAccount String
    The name of the master billing account that the subaccount will be created under in the form {billing_account_id} or billingAccounts/{billing_account_id}.
    name String
    The resource name of the billing account in the form billingAccounts/{billing_account_id}.
    open Boolean
    true if the billing account is open, false if the billing account is closed.

    Import

    Billing Subaccounts can be imported using any of these accepted formats:

    • billingAccounts/{billing_account_id}

    When using the pulumi import command, Billing Subaccounts can be imported using one of the formats above. For example:

    $ pulumi import gcp:billing/subAccount:SubAccount default billingAccounts/{billing_account_id}
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi