This page documents the language specification for the gcp package. If you're looking for help working with the inputs, outputs, or functions of gcp resources in a Pulumi program, please see the resource documentation for examples and API reference.

billing

This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-gcp repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-google repo.

class pulumi_gcp.billing.AccountIamBinding(resource_name, opts=None, billing_account_id=None, condition=None, members=None, role=None, __props__=None, __name__=None, __opts__=None)

Allows creation and management of a single binding within IAM policy for an existing Google Cloud Platform Billing Account.

Note: This resource must not be used in conjunction with

billing.AccountIamMember for the same role or they will fight over what your policy should be.

Note: On create, this resource will overwrite members of any existing roles.

Use pulumi import and inspect the output to ensure your existing members are preserved.

import pulumi
import pulumi_gcp as gcp

binding = gcp.billing.AccountIamBinding("binding",
    billing_account_id="00AA00-000AAA-00AA0A",
    members=["user:alice@gmail.com"],
    role="roles/billing.viewer")
Parameters

The condition object supports the following:

  • description (pulumi.Input[str])

  • expression (pulumi.Input[str])

  • title (pulumi.Input[str])

billing_account_id: pulumi.Output[str] = None

The billing account id.

etag: pulumi.Output[str] = None

(Computed) The etag of the billing account’s IAM policy.

members: pulumi.Output[list] = None

A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding

role: pulumi.Output[str] = None

The role that should be applied.

static get(resource_name, id, opts=None, billing_account_id=None, condition=None, etag=None, members=None, role=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • billing_account_id (pulumi.Input[str]) – The billing account id.

  • etag (pulumi.Input[str]) – (Computed) The etag of the billing account’s IAM policy.

  • members (pulumi.Input[list]) – A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding

  • role (pulumi.Input[str]) – The role that should be applied.

The condition object supports the following:

  • description (pulumi.Input[str])

  • expression (pulumi.Input[str])

  • title (pulumi.Input[str])

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.billing.AccountIamMember(resource_name, opts=None, billing_account_id=None, condition=None, member=None, role=None, __props__=None, __name__=None, __opts__=None)

Allows creation and management of a single member for a single binding within the IAM policy for an existing Google Cloud Platform Billing Account.

Note: This resource must not be used in conjunction with

billing.AccountIamBinding for the same role or they will fight over what your policy should be.

import pulumi
import pulumi_gcp as gcp

binding = gcp.billing.AccountIamMember("binding",
    billing_account_id="00AA00-000AAA-00AA0A",
    member="user:alice@gmail.com",
    role="roles/billing.viewer")
Parameters

The condition object supports the following:

  • description (pulumi.Input[str])

  • expression (pulumi.Input[str])

  • title (pulumi.Input[str])

billing_account_id: pulumi.Output[str] = None

The billing account id.

etag: pulumi.Output[str] = None

(Computed) The etag of the billing account’s IAM policy.

member: pulumi.Output[str] = None

The user that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding

role: pulumi.Output[str] = None

The role that should be applied.

static get(resource_name, id, opts=None, billing_account_id=None, condition=None, etag=None, member=None, role=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • billing_account_id (pulumi.Input[str]) – The billing account id.

  • etag (pulumi.Input[str]) – (Computed) The etag of the billing account’s IAM policy.

  • member (pulumi.Input[str]) – The user that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding

  • role (pulumi.Input[str]) – The role that should be applied.

The condition object supports the following:

  • description (pulumi.Input[str])

  • expression (pulumi.Input[str])

  • title (pulumi.Input[str])

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.billing.AccountIamPolicy(resource_name, opts=None, billing_account_id=None, policy_data=None, __props__=None, __name__=None, __opts__=None)

Allows management of the entire IAM policy for an existing Google Cloud Platform Billing Account.

Warning: Billing accounts have a default user that can be overwritten by use of this resource. The safest alternative is to use multiple billing.AccountIamBinding

resources. If you do use this resource, the best way to be sure that you are not making dangerous changes is to start by importing your existing policy, and examining the diff very closely.

Note: This resource must not be used in conjunction with

billing.AccountIamMember or billing.AccountIamBinding or they will fight over what your policy should be.

import pulumi
import pulumi_gcp as gcp

admin = gcp.organizations.get_iam_policy(binding=[{
    "role": "roles/billing.viewer",
    "members": ["user:jane@example.com"],
}])
policy = gcp.billing.AccountIamPolicy("policy",
    billing_account_id="00AA00-000AAA-00AA0A",
    policy_data=admin.policy_data)
Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • billing_account_id (pulumi.Input[str]) – The billing account id.

  • policy_data (pulumi.Input[str]) – The organizations.getIAMPolicy data source that represents the IAM policy that will be applied to the billing account. This policy overrides any existing policy applied to the billing account.

billing_account_id: pulumi.Output[str] = None

The billing account id.

policy_data: pulumi.Output[str] = None

The organizations.getIAMPolicy data source that represents the IAM policy that will be applied to the billing account. This policy overrides any existing policy applied to the billing account.

static get(resource_name, id, opts=None, billing_account_id=None, etag=None, policy_data=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • billing_account_id (pulumi.Input[str]) – The billing account id.

  • policy_data (pulumi.Input[str]) – The organizations.getIAMPolicy data source that represents the IAM policy that will be applied to the billing account. This policy overrides any existing policy applied to the billing account.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.billing.Budget(resource_name, opts=None, all_updates_rule=None, amount=None, billing_account=None, budget_filter=None, display_name=None, threshold_rules=None, __props__=None, __name__=None, __opts__=None)

Budget configuration for a billing account.

To get more information about Budget, see:

import pulumi
import pulumi_gcp as gcp

account = gcp.organizations.get_billing_account(billing_account="000000-0000000-0000000-000000")
budget = gcp.billing.Budget("budget",
    billing_account=account.id,
    display_name="Example Billing Budget",
    amount={
        "specified_amount": {
            "currencyCode": "USD",
            "units": "100000",
        },
    },
    threshold_rules=[{
        "thresholdPercent": 0.5,
    }])
import pulumi
import pulumi_gcp as gcp

account = gcp.organizations.get_billing_account(billing_account="000000-0000000-0000000-000000")
budget = gcp.billing.Budget("budget",
    billing_account=account.id,
    display_name="Example Billing Budget",
    budget_filter={
        "projects": ["projects/my-project-name"],
        "creditTypesTreatment": "EXCLUDE_ALL_CREDITS",
        "services": ["services/24E6-581D-38E5"],
    },
    amount={
        "specified_amount": {
            "currencyCode": "USD",
            "units": "100000",
        },
    },
    threshold_rules=[
        {
            "thresholdPercent": 0.5,
        },
        {
            "thresholdPercent": 0.9,
            "spendBasis": "FORECASTED_SPEND",
        },
    ])
Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • all_updates_rule (pulumi.Input[dict]) – Defines notifications that are sent on every update to the billing account’s spend, regardless of the thresholds defined using threshold rules. Structure is documented below.

  • amount (pulumi.Input[dict]) – The budgeted amount for each usage period. Structure is documented below.

  • billing_account (pulumi.Input[str]) – ID of the billing account to set a budget on.

  • budget_filter (pulumi.Input[dict]) – Filters that define which resources are used to compute the actual spend against the budget. Structure is documented below.

  • display_name (pulumi.Input[str]) – User data for display name in UI. Must be <= 60 chars.

  • threshold_rules (pulumi.Input[list]) – Rules that trigger alerts (notifications of thresholds being crossed) when spend exceeds the specified percentages of the budget. Structure is documented below.

The all_updates_rule object supports the following:

  • pubsubTopic (pulumi.Input[str]) - The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form projects/{project_id}/topics/{topic_id}. Updates are sent at regular intervals to the topic.

  • schemaVersion (pulumi.Input[str]) - The schema version of the notification. Only “1.0” is accepted. It represents the JSON schema as defined in https://cloud.google.com/billing/docs/how-to/budgets#notification_format.

The amount object supports the following:

  • specifiedAmount (pulumi.Input[dict]) - A specified amount to use as the budget. currencyCode is optional. If specified, it must match the currency of the billing account. The currencyCode is provided on output. Structure is documented below.

    • currencyCode (pulumi.Input[str]) - The 3-letter currency code defined in ISO 4217.

    • nanos (pulumi.Input[float]) - Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.

    • units (pulumi.Input[str]) - The whole units of the amount. For example if currencyCode is “USD”, then 1 unit is one US dollar.

The budget_filter object supports the following:

  • creditTypesTreatment (pulumi.Input[str]) - Specifies how credits should be treated when determining spend for threshold calculations.

  • projects (pulumi.Input[list]) - A set of projects of the form projects/{project_id}, specifying that usage from only this set of projects should be included in the budget. If omitted, the report will include all usage for the billing account, regardless of which project the usage occurred on. Only zero or one project can be specified currently.

  • services (pulumi.Input[list]) - A set of services of the form services/{service_id}, specifying that usage from only this set of services should be included in the budget. If omitted, the report will include usage for all the services. The service names are available through the Catalog API: https://cloud.google.com/billing/v1/how-tos/catalog-api.

The threshold_rules object supports the following:

  • spendBasis (pulumi.Input[str]) - The type of basis used to determine if spend has passed the threshold.

  • thresholdPercent (pulumi.Input[float]) - Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Must be >= 0.

all_updates_rule: pulumi.Output[dict] = None

Defines notifications that are sent on every update to the billing account’s spend, regardless of the thresholds defined using threshold rules. Structure is documented below.

  • pubsubTopic (str) - The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form projects/{project_id}/topics/{topic_id}. Updates are sent at regular intervals to the topic.

  • schemaVersion (str) - The schema version of the notification. Only “1.0” is accepted. It represents the JSON schema as defined in https://cloud.google.com/billing/docs/how-to/budgets#notification_format.

amount: pulumi.Output[dict] = None

The budgeted amount for each usage period. Structure is documented below.

  • specifiedAmount (dict) - A specified amount to use as the budget. currencyCode is optional. If specified, it must match the currency of the billing account. The currencyCode is provided on output. Structure is documented below.

    • currencyCode (str) - The 3-letter currency code defined in ISO 4217.

    • nanos (float) - Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.

    • units (str) - The whole units of the amount. For example if currencyCode is “USD”, then 1 unit is one US dollar.

billing_account: pulumi.Output[str] = None

ID of the billing account to set a budget on.

budget_filter: pulumi.Output[dict] = None

Filters that define which resources are used to compute the actual spend against the budget. Structure is documented below.

  • creditTypesTreatment (str) - Specifies how credits should be treated when determining spend for threshold calculations.

  • projects (list) - A set of projects of the form projects/{project_id}, specifying that usage from only this set of projects should be included in the budget. If omitted, the report will include all usage for the billing account, regardless of which project the usage occurred on. Only zero or one project can be specified currently.

  • services (list) - A set of services of the form services/{service_id}, specifying that usage from only this set of services should be included in the budget. If omitted, the report will include usage for all the services. The service names are available through the Catalog API: https://cloud.google.com/billing/v1/how-tos/catalog-api.

display_name: pulumi.Output[str] = None

User data for display name in UI. Must be <= 60 chars.

name: pulumi.Output[str] = None

Resource name of the budget. The resource name implies the scope of a budget. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.

threshold_rules: pulumi.Output[list] = None

Rules that trigger alerts (notifications of thresholds being crossed) when spend exceeds the specified percentages of the budget. Structure is documented below.

  • spendBasis (str) - The type of basis used to determine if spend has passed the threshold.

  • thresholdPercent (float) - Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Must be >= 0.

static get(resource_name, id, opts=None, all_updates_rule=None, amount=None, billing_account=None, budget_filter=None, display_name=None, name=None, threshold_rules=None)

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

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • all_updates_rule (pulumi.Input[dict]) – Defines notifications that are sent on every update to the billing account’s spend, regardless of the thresholds defined using threshold rules. Structure is documented below.

  • amount (pulumi.Input[dict]) – The budgeted amount for each usage period. Structure is documented below.

  • billing_account (pulumi.Input[str]) – ID of the billing account to set a budget on.

  • budget_filter (pulumi.Input[dict]) – Filters that define which resources are used to compute the actual spend against the budget. Structure is documented below.

  • display_name (pulumi.Input[str]) – User data for display name in UI. Must be <= 60 chars.

  • name (pulumi.Input[str]) – Resource name of the budget. The resource name implies the scope of a budget. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.

  • threshold_rules (pulumi.Input[list]) – Rules that trigger alerts (notifications of thresholds being crossed) when spend exceeds the specified percentages of the budget. Structure is documented below.

The all_updates_rule object supports the following:

  • pubsubTopic (pulumi.Input[str]) - The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form projects/{project_id}/topics/{topic_id}. Updates are sent at regular intervals to the topic.

  • schemaVersion (pulumi.Input[str]) - The schema version of the notification. Only “1.0” is accepted. It represents the JSON schema as defined in https://cloud.google.com/billing/docs/how-to/budgets#notification_format.

The amount object supports the following:

  • specifiedAmount (pulumi.Input[dict]) - A specified amount to use as the budget. currencyCode is optional. If specified, it must match the currency of the billing account. The currencyCode is provided on output. Structure is documented below.

    • currencyCode (pulumi.Input[str]) - The 3-letter currency code defined in ISO 4217.

    • nanos (pulumi.Input[float]) - Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.

    • units (pulumi.Input[str]) - The whole units of the amount. For example if currencyCode is “USD”, then 1 unit is one US dollar.

The budget_filter object supports the following:

  • creditTypesTreatment (pulumi.Input[str]) - Specifies how credits should be treated when determining spend for threshold calculations.

  • projects (pulumi.Input[list]) - A set of projects of the form projects/{project_id}, specifying that usage from only this set of projects should be included in the budget. If omitted, the report will include all usage for the billing account, regardless of which project the usage occurred on. Only zero or one project can be specified currently.

  • services (pulumi.Input[list]) - A set of services of the form services/{service_id}, specifying that usage from only this set of services should be included in the budget. If omitted, the report will include usage for all the services. The service names are available through the Catalog API: https://cloud.google.com/billing/v1/how-tos/catalog-api.

The threshold_rules object supports the following:

  • spendBasis (pulumi.Input[str]) - The type of basis used to determine if spend has passed the threshold.

  • thresholdPercent (pulumi.Input[float]) - Send an alert when this threshold is exceeded. This is a 1.0-based percentage, so 0.5 = 50%. Must be >= 0.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str