Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.24.0 published on Tuesday, May 17, 2022 by Pulumi

Budget

Budget configuration for a billing account.

To get more information about Budget, see:

Warning: If you are using User ADCs (Application Default Credentials) with this resource, you must specify a billing_project and set user_project_override to true in the provider configuration. Otherwise the Billing Budgets API will return a 403 error. Your account must have the serviceusage.services.use permission on the billing_project you defined.

Example Usage

Billing Budget Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var account = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
        {
            BillingAccount = "000000-0000000-0000000-000000",
        }));
        var budget = new Gcp.Billing.Budget("budget", new Gcp.Billing.BudgetArgs
        {
            BillingAccount = account.Apply(account => account.Id),
            DisplayName = "Example Billing Budget",
            Amount = new Gcp.Billing.Inputs.BudgetAmountArgs
            {
                SpecifiedAmount = new Gcp.Billing.Inputs.BudgetAmountSpecifiedAmountArgs
                {
                    CurrencyCode = "USD",
                    Units = "100000",
                },
            },
            ThresholdRules = 
            {
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 0.5,
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
	"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 {
		account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
			BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
			BillingAccount: pulumi.String(account.Id),
			DisplayName:    pulumi.String("Example Billing Budget"),
			Amount: &billing.BudgetAmountArgs{
				SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
					CurrencyCode: pulumi.String("USD"),
					Units:        pulumi.String("100000"),
				},
			},
			ThresholdRules: billing.BudgetThresholdRuleArray{
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(0.5),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var account = Output.of(OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
            .billingAccount("000000-0000000-0000000-000000")
            .build()));

        var budget = new Budget("budget", BudgetArgs.builder()        
            .billingAccount(account.apply(getBillingAccountResult -> getBillingAccountResult.getId()))
            .displayName("Example Billing Budget")
            .amount(BudgetAmount.builder()
                .specifiedAmount(BudgetAmountSpecifiedAmount.builder()
                    .currencyCode("USD")
                    .units("100000")
                    .build())
                .build())
            .thresholdRules(BudgetThresholdRule.builder()
                .thresholdPercent(0.5)
                .build())
            .build());

        }
}
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=gcp.billing.BudgetAmountArgs(
        specified_amount=gcp.billing.BudgetAmountSpecifiedAmountArgs(
            currency_code="USD",
            units="100000",
        ),
    ),
    threshold_rules=[gcp.billing.BudgetThresholdRuleArgs(
        threshold_percent=0.5,
    )])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const account = gcp.organizations.getBillingAccount({
    billingAccount: "000000-0000000-0000000-000000",
});
const budget = new gcp.billing.Budget("budget", {
    billingAccount: account.then(account => account.id),
    displayName: "Example Billing Budget",
    amount: {
        specifiedAmount: {
            currencyCode: "USD",
            units: "100000",
        },
    },
    thresholdRules: [{
        thresholdPercent: 0.5,
    }],
});
resources:
  budget:
    type: gcp:billing:Budget
    properties:
      billingAccount: ${account.id}
      displayName: Example Billing Budget
      amount:
        specifiedAmount:
          currencyCode: USD
          units: 100000
      thresholdRules:
        - thresholdPercent: 0.5
variables:
  account:
    Fn::Invoke:
      Function: gcp:organizations:getBillingAccount
      Arguments:
        billingAccount: 000000-0000000-0000000-000000

Billing Budget Lastperiod

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var account = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
        {
            BillingAccount = "000000-0000000-0000000-000000",
        }));
        var project = Output.Create(Gcp.Organizations.GetProject.InvokeAsync());
        var budget = new Gcp.Billing.Budget("budget", new Gcp.Billing.BudgetArgs
        {
            BillingAccount = account.Apply(account => account.Id),
            DisplayName = "Example Billing Budget",
            BudgetFilter = new Gcp.Billing.Inputs.BudgetBudgetFilterArgs
            {
                Projects = 
                {
                    project.Apply(project => $"projects/{project.Number}"),
                },
            },
            Amount = new Gcp.Billing.Inputs.BudgetAmountArgs
            {
                LastPeriodAmount = true,
            },
            ThresholdRules = 
            {
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 10,
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
	"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 {
		account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
			BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
		}, nil)
		if err != nil {
			return err
		}
		project, err := organizations.LookupProject(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
			BillingAccount: pulumi.String(account.Id),
			DisplayName:    pulumi.String("Example Billing Budget"),
			BudgetFilter: &billing.BudgetBudgetFilterArgs{
				Projects: pulumi.StringArray{
					pulumi.String(fmt.Sprintf("%v%v", "projects/", project.Number)),
				},
			},
			Amount: &billing.BudgetAmountArgs{
				LastPeriodAmount: pulumi.Bool(true),
			},
			ThresholdRules: billing.BudgetThresholdRuleArray{
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(10),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var account = Output.of(OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
            .billingAccount("000000-0000000-0000000-000000")
            .build()));

        final var project = Output.of(OrganizationsFunctions.getProject());

        var budget = new Budget("budget", BudgetArgs.builder()        
            .billingAccount(account.apply(getBillingAccountResult -> getBillingAccountResult.getId()))
            .displayName("Example Billing Budget")
            .budgetFilter(BudgetBudgetFilter.builder()
                .projects(String.format("projects/%s", project.apply(getProjectResult -> getProjectResult.getNumber())))
                .build())
            .amount(BudgetAmount.builder()
                .lastPeriodAmount(true)
                .build())
            .thresholdRules(BudgetThresholdRule.builder()
                .thresholdPercent(10)
                .build())
            .build());

        }
}
import pulumi
import pulumi_gcp as gcp

account = gcp.organizations.get_billing_account(billing_account="000000-0000000-0000000-000000")
project = gcp.organizations.get_project()
budget = gcp.billing.Budget("budget",
    billing_account=account.id,
    display_name="Example Billing Budget",
    budget_filter=gcp.billing.BudgetBudgetFilterArgs(
        projects=[f"projects/{project.number}"],
    ),
    amount=gcp.billing.BudgetAmountArgs(
        last_period_amount=True,
    ),
    threshold_rules=[gcp.billing.BudgetThresholdRuleArgs(
        threshold_percent=10,
    )])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const account = gcp.organizations.getBillingAccount({
    billingAccount: "000000-0000000-0000000-000000",
});
const project = gcp.organizations.getProject({});
const budget = new gcp.billing.Budget("budget", {
    billingAccount: account.then(account => account.id),
    displayName: "Example Billing Budget",
    budgetFilter: {
        projects: [project.then(project => `projects/${project.number}`)],
    },
    amount: {
        lastPeriodAmount: true,
    },
    thresholdRules: [{
        thresholdPercent: 10,
    }],
});
resources:
  budget:
    type: gcp:billing:Budget
    properties:
      billingAccount: ${account.id}
      displayName: Example Billing Budget
      budgetFilter:
        projects:
          - projects/${project.number}
      amount:
        lastPeriodAmount: true
      thresholdRules:
        - thresholdPercent: 10
variables:
  account:
    Fn::Invoke:
      Function: gcp:organizations:getBillingAccount
      Arguments:
        billingAccount: 000000-0000000-0000000-000000
  project:
    Fn::Invoke:
      Function: gcp:organizations:getProject
      Arguments: {}

Billing Budget Filter

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var account = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
        {
            BillingAccount = "000000-0000000-0000000-000000",
        }));
        var project = Output.Create(Gcp.Organizations.GetProject.InvokeAsync());
        var budget = new Gcp.Billing.Budget("budget", new Gcp.Billing.BudgetArgs
        {
            BillingAccount = account.Apply(account => account.Id),
            DisplayName = "Example Billing Budget",
            BudgetFilter = new Gcp.Billing.Inputs.BudgetBudgetFilterArgs
            {
                Projects = 
                {
                    project.Apply(project => $"projects/{project.Number}"),
                },
                CreditTypesTreatment = "EXCLUDE_ALL_CREDITS",
                Services = 
                {
                    "services/24E6-581D-38E5",
                },
            },
            Amount = new Gcp.Billing.Inputs.BudgetAmountArgs
            {
                SpecifiedAmount = new Gcp.Billing.Inputs.BudgetAmountSpecifiedAmountArgs
                {
                    CurrencyCode = "USD",
                    Units = "100000",
                },
            },
            ThresholdRules = 
            {
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 0.5,
                },
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 0.9,
                    SpendBasis = "FORECASTED_SPEND",
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
	"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 {
		account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
			BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
		}, nil)
		if err != nil {
			return err
		}
		project, err := organizations.LookupProject(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
			BillingAccount: pulumi.String(account.Id),
			DisplayName:    pulumi.String("Example Billing Budget"),
			BudgetFilter: &billing.BudgetBudgetFilterArgs{
				Projects: pulumi.StringArray{
					pulumi.String(fmt.Sprintf("%v%v", "projects/", project.Number)),
				},
				CreditTypesTreatment: pulumi.String("EXCLUDE_ALL_CREDITS"),
				Services: pulumi.StringArray{
					pulumi.String("services/24E6-581D-38E5"),
				},
			},
			Amount: &billing.BudgetAmountArgs{
				SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
					CurrencyCode: pulumi.String("USD"),
					Units:        pulumi.String("100000"),
				},
			},
			ThresholdRules: billing.BudgetThresholdRuleArray{
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(0.5),
				},
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(0.9),
					SpendBasis:       pulumi.String("FORECASTED_SPEND"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var account = Output.of(OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
            .billingAccount("000000-0000000-0000000-000000")
            .build()));

        final var project = Output.of(OrganizationsFunctions.getProject());

        var budget = new Budget("budget", BudgetArgs.builder()        
            .billingAccount(account.apply(getBillingAccountResult -> getBillingAccountResult.getId()))
            .displayName("Example Billing Budget")
            .budgetFilter(BudgetBudgetFilter.builder()
                .projects(String.format("projects/%s", project.apply(getProjectResult -> getProjectResult.getNumber())))
                .creditTypesTreatment("EXCLUDE_ALL_CREDITS")
                .services("services/24E6-581D-38E5")
                .build())
            .amount(BudgetAmount.builder()
                .specifiedAmount(BudgetAmountSpecifiedAmount.builder()
                    .currencyCode("USD")
                    .units("100000")
                    .build())
                .build())
            .thresholdRules(            
                BudgetThresholdRule.builder()
                    .thresholdPercent(0.5)
                    .build(),
                BudgetThresholdRule.builder()
                    .thresholdPercent(0.9)
                    .spendBasis("FORECASTED_SPEND")
                    .build())
            .build());

        }
}
import pulumi
import pulumi_gcp as gcp

account = gcp.organizations.get_billing_account(billing_account="000000-0000000-0000000-000000")
project = gcp.organizations.get_project()
budget = gcp.billing.Budget("budget",
    billing_account=account.id,
    display_name="Example Billing Budget",
    budget_filter=gcp.billing.BudgetBudgetFilterArgs(
        projects=[f"projects/{project.number}"],
        credit_types_treatment="EXCLUDE_ALL_CREDITS",
        services=["services/24E6-581D-38E5"],
    ),
    amount=gcp.billing.BudgetAmountArgs(
        specified_amount=gcp.billing.BudgetAmountSpecifiedAmountArgs(
            currency_code="USD",
            units="100000",
        ),
    ),
    threshold_rules=[
        gcp.billing.BudgetThresholdRuleArgs(
            threshold_percent=0.5,
        ),
        gcp.billing.BudgetThresholdRuleArgs(
            threshold_percent=0.9,
            spend_basis="FORECASTED_SPEND",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const account = gcp.organizations.getBillingAccount({
    billingAccount: "000000-0000000-0000000-000000",
});
const project = gcp.organizations.getProject({});
const budget = new gcp.billing.Budget("budget", {
    billingAccount: account.then(account => account.id),
    displayName: "Example Billing Budget",
    budgetFilter: {
        projects: [project.then(project => `projects/${project.number}`)],
        creditTypesTreatment: "EXCLUDE_ALL_CREDITS",
        services: ["services/24E6-581D-38E5"],
    },
    amount: {
        specifiedAmount: {
            currencyCode: "USD",
            units: "100000",
        },
    },
    thresholdRules: [
        {
            thresholdPercent: 0.5,
        },
        {
            thresholdPercent: 0.9,
            spendBasis: "FORECASTED_SPEND",
        },
    ],
});
resources:
  budget:
    type: gcp:billing:Budget
    properties:
      billingAccount: ${account.id}
      displayName: Example Billing Budget
      budgetFilter:
        projects:
          - projects/${project.number}
        creditTypesTreatment: EXCLUDE_ALL_CREDITS
        services:
          - services/24E6-581D-38E5
      amount:
        specifiedAmount:
          currencyCode: USD
          units: 100000
      thresholdRules:
        - thresholdPercent: 0.5
        - thresholdPercent: 0.9
          spendBasis: FORECASTED_SPEND
variables:
  account:
    Fn::Invoke:
      Function: gcp:organizations:getBillingAccount
      Arguments:
        billingAccount: 000000-0000000-0000000-000000
  project:
    Fn::Invoke:
      Function: gcp:organizations:getProject
      Arguments: {}

Billing Budget Notify

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var account = Output.Create(Gcp.Organizations.GetBillingAccount.InvokeAsync(new Gcp.Organizations.GetBillingAccountArgs
        {
            BillingAccount = "000000-0000000-0000000-000000",
        }));
        var project = Output.Create(Gcp.Organizations.GetProject.InvokeAsync());
        var notificationChannel = new Gcp.Monitoring.NotificationChannel("notificationChannel", new Gcp.Monitoring.NotificationChannelArgs
        {
            DisplayName = "Example Notification Channel",
            Type = "email",
            Labels = 
            {
                { "email_address", "address@example.com" },
            },
        });
        var budget = new Gcp.Billing.Budget("budget", new Gcp.Billing.BudgetArgs
        {
            BillingAccount = account.Apply(account => account.Id),
            DisplayName = "Example Billing Budget",
            BudgetFilter = new Gcp.Billing.Inputs.BudgetBudgetFilterArgs
            {
                Projects = 
                {
                    project.Apply(project => $"projects/{project.Number}"),
                },
            },
            Amount = new Gcp.Billing.Inputs.BudgetAmountArgs
            {
                SpecifiedAmount = new Gcp.Billing.Inputs.BudgetAmountSpecifiedAmountArgs
                {
                    CurrencyCode = "USD",
                    Units = "100000",
                },
            },
            ThresholdRules = 
            {
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 1,
                },
                new Gcp.Billing.Inputs.BudgetThresholdRuleArgs
                {
                    ThresholdPercent = 1,
                    SpendBasis = "FORECASTED_SPEND",
                },
            },
            AllUpdatesRule = new Gcp.Billing.Inputs.BudgetAllUpdatesRuleArgs
            {
                MonitoringNotificationChannels = 
                {
                    notificationChannel.Id,
                },
                DisableDefaultIamRecipients = true,
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/billing"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/monitoring"
	"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 {
		account, err := organizations.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
			BillingAccount: pulumi.StringRef("000000-0000000-0000000-000000"),
		}, nil)
		if err != nil {
			return err
		}
		project, err := organizations.LookupProject(ctx, nil, nil)
		if err != nil {
			return err
		}
		notificationChannel, err := monitoring.NewNotificationChannel(ctx, "notificationChannel", &monitoring.NotificationChannelArgs{
			DisplayName: pulumi.String("Example Notification Channel"),
			Type:        pulumi.String("email"),
			Labels: pulumi.StringMap{
				"email_address": pulumi.String("address@example.com"),
			},
		})
		if err != nil {
			return err
		}
		_, err = billing.NewBudget(ctx, "budget", &billing.BudgetArgs{
			BillingAccount: pulumi.String(account.Id),
			DisplayName:    pulumi.String("Example Billing Budget"),
			BudgetFilter: &billing.BudgetBudgetFilterArgs{
				Projects: pulumi.StringArray{
					pulumi.String(fmt.Sprintf("%v%v", "projects/", project.Number)),
				},
			},
			Amount: &billing.BudgetAmountArgs{
				SpecifiedAmount: &billing.BudgetAmountSpecifiedAmountArgs{
					CurrencyCode: pulumi.String("USD"),
					Units:        pulumi.String("100000"),
				},
			},
			ThresholdRules: billing.BudgetThresholdRuleArray{
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(1),
				},
				&billing.BudgetThresholdRuleArgs{
					ThresholdPercent: pulumi.Float64(1),
					SpendBasis:       pulumi.String("FORECASTED_SPEND"),
				},
			},
			AllUpdatesRule: &billing.BudgetAllUpdatesRuleArgs{
				MonitoringNotificationChannels: pulumi.StringArray{
					notificationChannel.ID(),
				},
				DisableDefaultIamRecipients: pulumi.Bool(true),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var account = Output.of(OrganizationsFunctions.getBillingAccount(GetBillingAccountArgs.builder()
            .billingAccount("000000-0000000-0000000-000000")
            .build()));

        final var project = Output.of(OrganizationsFunctions.getProject());

        var notificationChannel = new NotificationChannel("notificationChannel", NotificationChannelArgs.builder()        
            .displayName("Example Notification Channel")
            .type("email")
            .labels(Map.of("email_address", "address@example.com"))
            .build());

        var budget = new Budget("budget", BudgetArgs.builder()        
            .billingAccount(account.apply(getBillingAccountResult -> getBillingAccountResult.getId()))
            .displayName("Example Billing Budget")
            .budgetFilter(BudgetBudgetFilter.builder()
                .projects(String.format("projects/%s", project.apply(getProjectResult -> getProjectResult.getNumber())))
                .build())
            .amount(BudgetAmount.builder()
                .specifiedAmount(BudgetAmountSpecifiedAmount.builder()
                    .currencyCode("USD")
                    .units("100000")
                    .build())
                .build())
            .thresholdRules(            
                BudgetThresholdRule.builder()
                    .thresholdPercent(1)
                    .build(),
                BudgetThresholdRule.builder()
                    .thresholdPercent(1)
                    .spendBasis("FORECASTED_SPEND")
                    .build())
            .allUpdatesRule(BudgetAllUpdatesRule.builder()
                .monitoringNotificationChannels(notificationChannel.getId())
                .disableDefaultIamRecipients(true)
                .build())
            .build());

        }
}
import pulumi
import pulumi_gcp as gcp

account = gcp.organizations.get_billing_account(billing_account="000000-0000000-0000000-000000")
project = gcp.organizations.get_project()
notification_channel = gcp.monitoring.NotificationChannel("notificationChannel",
    display_name="Example Notification Channel",
    type="email",
    labels={
        "email_address": "address@example.com",
    })
budget = gcp.billing.Budget("budget",
    billing_account=account.id,
    display_name="Example Billing Budget",
    budget_filter=gcp.billing.BudgetBudgetFilterArgs(
        projects=[f"projects/{project.number}"],
    ),
    amount=gcp.billing.BudgetAmountArgs(
        specified_amount=gcp.billing.BudgetAmountSpecifiedAmountArgs(
            currency_code="USD",
            units="100000",
        ),
    ),
    threshold_rules=[
        gcp.billing.BudgetThresholdRuleArgs(
            threshold_percent=1,
        ),
        gcp.billing.BudgetThresholdRuleArgs(
            threshold_percent=1,
            spend_basis="FORECASTED_SPEND",
        ),
    ],
    all_updates_rule=gcp.billing.BudgetAllUpdatesRuleArgs(
        monitoring_notification_channels=[notification_channel.id],
        disable_default_iam_recipients=True,
    ))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const account = gcp.organizations.getBillingAccount({
    billingAccount: "000000-0000000-0000000-000000",
});
const project = gcp.organizations.getProject({});
const notificationChannel = new gcp.monitoring.NotificationChannel("notificationChannel", {
    displayName: "Example Notification Channel",
    type: "email",
    labels: {
        email_address: "address@example.com",
    },
});
const budget = new gcp.billing.Budget("budget", {
    billingAccount: account.then(account => account.id),
    displayName: "Example Billing Budget",
    budgetFilter: {
        projects: [project.then(project => `projects/${project.number}`)],
    },
    amount: {
        specifiedAmount: {
            currencyCode: "USD",
            units: "100000",
        },
    },
    thresholdRules: [
        {
            thresholdPercent: 1,
        },
        {
            thresholdPercent: 1,
            spendBasis: "FORECASTED_SPEND",
        },
    ],
    allUpdatesRule: {
        monitoringNotificationChannels: [notificationChannel.id],
        disableDefaultIamRecipients: true,
    },
});
resources:
  budget:
    type: gcp:billing:Budget
    properties:
      billingAccount: ${account.id}
      displayName: Example Billing Budget
      budgetFilter:
        projects:
          - projects/${project.number}
      amount:
        specifiedAmount:
          currencyCode: USD
          units: 100000
      thresholdRules:
        - thresholdPercent: 1
        - thresholdPercent: 1
          spendBasis: FORECASTED_SPEND
      allUpdatesRule:
        monitoringNotificationChannels:
          - ${notificationChannel.id}
        disableDefaultIamRecipients: true
  notificationChannel:
    type: gcp:monitoring:NotificationChannel
    properties:
      displayName: Example Notification Channel
      type: email
      labels:
        email_address: address@example.com
variables:
  account:
    Fn::Invoke:
      Function: gcp:organizations:getBillingAccount
      Arguments:
        billingAccount: 000000-0000000-0000000-000000
  project:
    Fn::Invoke:
      Function: gcp:organizations:getProject
      Arguments: {}

Create a Budget Resource

new Budget(name: string, args: BudgetArgs, opts?: CustomResourceOptions);
@overload
def Budget(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           all_updates_rule: Optional[BudgetAllUpdatesRuleArgs] = None,
           amount: Optional[BudgetAmountArgs] = None,
           billing_account: Optional[str] = None,
           budget_filter: Optional[BudgetBudgetFilterArgs] = None,
           display_name: Optional[str] = None,
           threshold_rules: Optional[Sequence[BudgetThresholdRuleArgs]] = None)
@overload
def Budget(resource_name: str,
           args: BudgetArgs,
           opts: Optional[ResourceOptions] = None)
func NewBudget(ctx *Context, name string, args BudgetArgs, opts ...ResourceOption) (*Budget, error)
public Budget(string name, BudgetArgs args, CustomResourceOptions? opts = null)
public Budget(String name, BudgetArgs args)
public Budget(String name, BudgetArgs args, CustomResourceOptions options)
type: gcp:billing:Budget
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BudgetArgs
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 BudgetArgs
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 BudgetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BudgetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BudgetArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Budget 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 Budget resource accepts the following input properties:

Amount BudgetAmountArgs

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

BillingAccount string

ID of the billing account to set a budget on.

ThresholdRules List<BudgetThresholdRuleArgs>

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

AllUpdatesRule BudgetAllUpdatesRuleArgs

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.

BudgetFilter BudgetBudgetFilterArgs

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

DisplayName string

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

Amount BudgetAmountArgs

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

BillingAccount string

ID of the billing account to set a budget on.

ThresholdRules []BudgetThresholdRuleArgs

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

AllUpdatesRule BudgetAllUpdatesRuleArgs

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.

BudgetFilter BudgetBudgetFilterArgs

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

DisplayName string

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

amount BudgetAmountArgs

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

billingAccount String

ID of the billing account to set a budget on.

thresholdRules ListThresholdRuleArgs>

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

allUpdatesRule BudgetAllUpdatesRuleArgs

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.

budgetFilter BudgetBudgetFilterArgs

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

displayName String

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

amount BudgetAmountArgs

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

billingAccount string

ID of the billing account to set a budget on.

thresholdRules BudgetThresholdRuleArgs[]

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

allUpdatesRule BudgetAllUpdatesRuleArgs

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.

budgetFilter BudgetBudgetFilterArgs

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

displayName string

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

amount BudgetAmountArgs

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

billing_account str

ID of the billing account to set a budget on.

threshold_rules Sequence[BudgetThresholdRuleArgs]

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

all_updates_rule BudgetAllUpdatesRuleArgs

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.

budget_filter BudgetBudgetFilterArgs

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

display_name str

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

amount Property Map

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

billingAccount String

ID of the billing account to set a budget on.

thresholdRules List

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

allUpdatesRule Property Map

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.

budgetFilter Property Map

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

displayName String

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

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Name string

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

Id string

The provider-assigned unique ID for this managed resource.

Name string

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

id String

The provider-assigned unique ID for this managed resource.

name String

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

id string

The provider-assigned unique ID for this managed resource.

name string

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

id str

The provider-assigned unique ID for this managed resource.

name str

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

id String

The provider-assigned unique ID for this managed resource.

name String

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

Look up an Existing Budget Resource

Get an existing Budget 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?: BudgetState, opts?: CustomResourceOptions): Budget
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        all_updates_rule: Optional[BudgetAllUpdatesRuleArgs] = None,
        amount: Optional[BudgetAmountArgs] = None,
        billing_account: Optional[str] = None,
        budget_filter: Optional[BudgetBudgetFilterArgs] = None,
        display_name: Optional[str] = None,
        name: Optional[str] = None,
        threshold_rules: Optional[Sequence[BudgetThresholdRuleArgs]] = None) -> Budget
func GetBudget(ctx *Context, name string, id IDInput, state *BudgetState, opts ...ResourceOption) (*Budget, error)
public static Budget Get(string name, Input<string> id, BudgetState? state, CustomResourceOptions? opts = null)
public static Budget get(String name, Output<String> id, BudgetState 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:
AllUpdatesRule BudgetAllUpdatesRuleArgs

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 BudgetAmountArgs

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

BillingAccount string

ID of the billing account to set a budget on.

BudgetFilter BudgetBudgetFilterArgs

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

DisplayName string

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

Name string

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

ThresholdRules List<BudgetThresholdRuleArgs>

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

AllUpdatesRule BudgetAllUpdatesRuleArgs

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 BudgetAmountArgs

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

BillingAccount string

ID of the billing account to set a budget on.

BudgetFilter BudgetBudgetFilterArgs

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

DisplayName string

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

Name string

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

ThresholdRules []BudgetThresholdRuleArgs

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

allUpdatesRule BudgetAllUpdatesRuleArgs

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 BudgetAmountArgs

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

billingAccount String

ID of the billing account to set a budget on.

budgetFilter BudgetBudgetFilterArgs

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

displayName String

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

name String

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

thresholdRules ListThresholdRuleArgs>

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

allUpdatesRule BudgetAllUpdatesRuleArgs

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 BudgetAmountArgs

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

billingAccount string

ID of the billing account to set a budget on.

budgetFilter BudgetBudgetFilterArgs

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

displayName string

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

name string

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

thresholdRules BudgetThresholdRuleArgs[]

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

all_updates_rule BudgetAllUpdatesRuleArgs

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 BudgetAmountArgs

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

billing_account str

ID of the billing account to set a budget on.

budget_filter BudgetBudgetFilterArgs

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

display_name str

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

name 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 Sequence[BudgetThresholdRuleArgs]

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

allUpdatesRule Property Map

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 Property Map

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

billingAccount String

ID of the billing account to set a budget on.

budgetFilter Property Map

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

displayName String

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

name String

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

thresholdRules List

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

Supporting Types

BudgetAllUpdatesRule

DisableDefaultIamRecipients bool

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

MonitoringNotificationChannels List<string>

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

PubsubTopic string

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 string

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.

DisableDefaultIamRecipients bool

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

MonitoringNotificationChannels []string

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

PubsubTopic string

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 string

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.

disableDefaultIamRecipients Boolean

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

monitoringNotificationChannels List

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

pubsubTopic String

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 String

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.

disableDefaultIamRecipients boolean

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

monitoringNotificationChannels string[]

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

pubsubTopic string

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 string

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.

disable_default_iam_recipients bool

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

monitoring_notification_channels Sequence[str]

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

pubsub_topic 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.

schema_version 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.

disableDefaultIamRecipients Boolean

Boolean. When set to true, disables default notifications sent when a threshold is exceeded. Default recipients are those with Billing Account Administrators and Billing Account Users IAM roles for the target account.

monitoringNotificationChannels List

The full resource name of a monitoring notification channel in the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed.

pubsubTopic String

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 String

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.

BudgetAmount

LastPeriodAmount bool

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

SpecifiedAmount BudgetAmountSpecifiedAmount

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.

LastPeriodAmount bool

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

SpecifiedAmount BudgetAmountSpecifiedAmount

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.

lastPeriodAmount Boolean

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

specifiedAmount BudgetAmountSpecifiedAmount

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.

lastPeriodAmount boolean

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

specifiedAmount BudgetAmountSpecifiedAmount

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.

last_period_amount bool

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

specified_amount BudgetAmountSpecifiedAmount

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.

lastPeriodAmount Boolean

Configures a budget amount that is automatically set to 100% of last period's spend. Boolean. Set value to true to use. Do not set to false, instead use the specified_amount block.

specifiedAmount Property Map

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.

BudgetAmountSpecifiedAmount

CurrencyCode string

The 3-letter currency code defined in ISO 4217.

Nanos int

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 string

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

CurrencyCode string

The 3-letter currency code defined in ISO 4217.

Nanos int

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 string

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

currencyCode String

The 3-letter currency code defined in ISO 4217.

nanos Integer

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 String

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

currencyCode string

The 3-letter currency code defined in ISO 4217.

nanos number

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 string

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

currency_code str

The 3-letter currency code defined in ISO 4217.

nanos int

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.

currencyCode String

The 3-letter currency code defined in ISO 4217.

nanos Number

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 String

The whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.

BudgetBudgetFilter

CreditTypes List<string>

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

CreditTypesTreatment string

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

Labels Dictionary<string, string>

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

Projects List<string>

A set of projects of the form projects/{project_number}, 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.

Services List<string>

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.

Subaccounts List<string>

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

CreditTypes []string

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

CreditTypesTreatment string

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

Labels map[string]string

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

Projects []string

A set of projects of the form projects/{project_number}, 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.

Services []string

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.

Subaccounts []string

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypes List

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypesTreatment String

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

labels Map

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

projects List

A set of projects of the form projects/{project_number}, 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.

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.

subaccounts List

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypes string[]

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypesTreatment string

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

labels {[key: string]: string}

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

projects string[]

A set of projects of the form projects/{project_number}, 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.

services string[]

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.

subaccounts string[]

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

credit_types Sequence[str]

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

credit_types_treatment str

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

labels Mapping[str, str]

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

projects Sequence[str]

A set of projects of the form projects/{project_number}, 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.

services Sequence[str]

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.

subaccounts Sequence[str]

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypes List

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

creditTypesTreatment String

Specifies how credits should be treated when determining spend for threshold calculations. Default value is INCLUDE_ALL_CREDITS. Possible values are INCLUDE_ALL_CREDITS, EXCLUDE_ALL_CREDITS, and INCLUDE_SPECIFIED_CREDITS.

labels Map

A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget.

projects List

A set of projects of the form projects/{project_number}, 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.

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.

subaccounts List

A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist.

BudgetThresholdRule

ThresholdPercent double

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

SpendBasis string

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

ThresholdPercent float64

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

SpendBasis string

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

thresholdPercent Double

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

spendBasis String

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

thresholdPercent number

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

spendBasis string

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

threshold_percent float

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

spend_basis str

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

thresholdPercent Number

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

spendBasis String

The type of basis used to determine if spend has passed the threshold. Default value is CURRENT_SPEND. Possible values are CURRENT_SPEND and FORECASTED_SPEND.

Import

Budget can be imported using any of these accepted formats

 $ pulumi import gcp:billing/budget:Budget default billingAccounts/{{billing_account}}/budgets/{{name}}
 $ pulumi import gcp:billing/budget:Budget default {{billing_account}}/{{name}}
 $ pulumi import gcp:billing/budget:Budget default {{name}}

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.