BudgetArgs

data class BudgetArgs(val amount: Output<Double>? = null, val budgetName: Output<String>? = null, val category: Output<Either<String, CategoryType>>? = null, val eTag: Output<String>? = null, val filter: Output<BudgetFilterArgs>? = null, val notifications: Output<Map<String, NotificationArgs>>? = null, val scope: Output<String>? = null, val timeGrain: Output<Either<String, TimeGrainType>>? = null, val timePeriod: Output<BudgetTimePeriodArgs>? = null) : ConvertibleToJava<BudgetArgs>

A budget resource. Uses Azure REST API version 2024-08-01. In version 2.x of the Azure Native provider, it used API version 2023-05-01. Other available API versions: 2023-05-01, 2023-11-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native consumption [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

CreateOrUpdateBudget

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var budget = new AzureNative.Consumption.Budget("budget", new()
{
Amount = 100.65,
BudgetName = "TestBudget",
Category = AzureNative.Consumption.CategoryType.Cost,
ETag = "\"1d34d016a593709\"",
Filter = new AzureNative.Consumption.Inputs.BudgetFilterArgs
{
And = new[]
{
new AzureNative.Consumption.Inputs.BudgetFilterPropertiesArgs
{
Dimensions = new AzureNative.Consumption.Inputs.BudgetComparisonExpressionArgs
{
Name = "ResourceId",
Operator = AzureNative.Consumption.BudgetOperatorType.In,
Values = new[]
{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1",
},
},
},
new AzureNative.Consumption.Inputs.BudgetFilterPropertiesArgs
{
Tags = new AzureNative.Consumption.Inputs.BudgetComparisonExpressionArgs
{
Name = "category",
Operator = AzureNative.Consumption.BudgetOperatorType.In,
Values = new[]
{
"Dev",
"Prod",
},
},
},
new AzureNative.Consumption.Inputs.BudgetFilterPropertiesArgs
{
Tags = new AzureNative.Consumption.Inputs.BudgetComparisonExpressionArgs
{
Name = "department",
Operator = AzureNative.Consumption.BudgetOperatorType.In,
Values = new[]
{
"engineering",
"sales",
},
},
},
},
},
Notifications =
{
{ "Actual_GreaterThan_80_Percent", new AzureNative.Consumption.Inputs.NotificationArgs
{
ContactEmails = new[]
{
"johndoe@contoso.com",
"janesmith@contoso.com",
},
ContactGroups = new[]
{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup",
},
ContactRoles = new[]
{
"Contributor",
"Reader",
},
Enabled = true,
Locale = AzureNative.Consumption.CultureCode.En_us,
Operator = AzureNative.Consumption.OperatorType.GreaterThan,
Threshold = 80,
ThresholdType = AzureNative.Consumption.ThresholdType.Actual,
} },
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
TimeGrain = AzureNative.Consumption.TimeGrainType.Monthly,
TimePeriod = new AzureNative.Consumption.Inputs.BudgetTimePeriodArgs
{
EndDate = "2018-10-31T00:00:00Z",
StartDate = "2017-10-01T00:00:00Z",
},
});
});
package main
import (
consumption "github.com/pulumi/pulumi-azure-native-sdk/consumption/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := consumption.NewBudget(ctx, "budget", &consumption.BudgetArgs{
Amount: pulumi.Float64(100.65),
BudgetName: pulumi.String("TestBudget"),
Category: pulumi.String(consumption.CategoryTypeCost),
ETag: pulumi.String("\"1d34d016a593709\""),
Filter: &consumption.BudgetFilterArgs{
And: consumption.BudgetFilterPropertiesArray{
&consumption.BudgetFilterPropertiesArgs{
Dimensions: &consumption.BudgetComparisonExpressionArgs{
Name: pulumi.String("ResourceId"),
Operator: pulumi.String(consumption.BudgetOperatorTypeIn),
Values: pulumi.StringArray{
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"),
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1"),
},
},
},
&consumption.BudgetFilterPropertiesArgs{
Tags: &consumption.BudgetComparisonExpressionArgs{
Name: pulumi.String("category"),
Operator: pulumi.String(consumption.BudgetOperatorTypeIn),
Values: pulumi.StringArray{
pulumi.String("Dev"),
pulumi.String("Prod"),
},
},
},
&consumption.BudgetFilterPropertiesArgs{
Tags: &consumption.BudgetComparisonExpressionArgs{
Name: pulumi.String("department"),
Operator: pulumi.String(consumption.BudgetOperatorTypeIn),
Values: pulumi.StringArray{
pulumi.String("engineering"),
pulumi.String("sales"),
},
},
},
},
},
Notifications: consumption.NotificationMap{
"Actual_GreaterThan_80_Percent": &consumption.NotificationArgs{
ContactEmails: pulumi.StringArray{
pulumi.String("johndoe@contoso.com"),
pulumi.String("janesmith@contoso.com"),
},
ContactGroups: pulumi.StringArray{
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup"),
},
ContactRoles: pulumi.StringArray{
pulumi.String("Contributor"),
pulumi.String("Reader"),
},
Enabled: pulumi.Bool(true),
Locale: pulumi.String(consumption.CultureCode_En_Us),
Operator: pulumi.String(consumption.OperatorTypeGreaterThan),
Threshold: pulumi.Float64(80),
ThresholdType: pulumi.String(consumption.ThresholdTypeActual),
},
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000"),
TimeGrain: pulumi.String(consumption.TimeGrainTypeMonthly),
TimePeriod: &consumption.BudgetTimePeriodArgs{
EndDate: pulumi.String("2018-10-31T00:00:00Z"),
StartDate: pulumi.String("2017-10-01T00:00:00Z"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.consumption.Budget;
import com.pulumi.azurenative.consumption.BudgetArgs;
import com.pulumi.azurenative.consumption.inputs.BudgetFilterArgs;
import com.pulumi.azurenative.consumption.inputs.BudgetTimePeriodArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var budget = new Budget("budget", BudgetArgs.builder()
.amount(100.65)
.budgetName("TestBudget")
.category("Cost")
.eTag("\"1d34d016a593709\"")
.filter(BudgetFilterArgs.builder()
.and(
BudgetFilterPropertiesArgs.builder()
.dimensions(BudgetComparisonExpressionArgs.builder()
.name("ResourceId")
.operator("In")
.values(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")
.build())
.build(),
BudgetFilterPropertiesArgs.builder()
.tags(BudgetComparisonExpressionArgs.builder()
.name("category")
.operator("In")
.values(
"Dev",
"Prod")
.build())
.build(),
BudgetFilterPropertiesArgs.builder()
.tags(BudgetComparisonExpressionArgs.builder()
.name("department")
.operator("In")
.values(
"engineering",
"sales")
.build())
.build())
.build())
.notifications(Map.of("Actual_GreaterThan_80_Percent", Map.ofEntries(
Map.entry("contactEmails",
"johndoe@contoso.com",
"janesmith@contoso.com"),
Map.entry("contactGroups", "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup"),
Map.entry("contactRoles",
"Contributor",
"Reader"),
Map.entry("enabled", true),
Map.entry("locale", "en-us"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 80),
Map.entry("thresholdType", "Actual")
)))
.scope("subscriptions/00000000-0000-0000-0000-000000000000")
.timeGrain("Monthly")
.timePeriod(BudgetTimePeriodArgs.builder()
.endDate("2018-10-31T00:00:00Z")
.startDate("2017-10-01T00:00:00Z")
.build())
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:consumption:Budget TestBudget /{scope}/providers/Microsoft.Consumption/budgets/{budgetName}

Constructors

Link copied to clipboard
constructor(amount: Output<Double>? = null, budgetName: Output<String>? = null, category: Output<Either<String, CategoryType>>? = null, eTag: Output<String>? = null, filter: Output<BudgetFilterArgs>? = null, notifications: Output<Map<String, NotificationArgs>>? = null, scope: Output<String>? = null, timeGrain: Output<Either<String, TimeGrainType>>? = null, timePeriod: Output<BudgetTimePeriodArgs>? = null)

Properties

Link copied to clipboard
val amount: Output<Double>? = null

The total amount of cost to track with the budget

Link copied to clipboard
val budgetName: Output<String>? = null

Budget Name.

Link copied to clipboard
val category: Output<Either<String, CategoryType>>? = null

The category of the budget, whether the budget tracks cost or usage.

Link copied to clipboard
val eTag: Output<String>? = null

eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.

Link copied to clipboard
val filter: Output<BudgetFilterArgs>? = null

May be used to filter budgets by user-specified dimensions and/or tags.

Link copied to clipboard
val notifications: Output<Map<String, NotificationArgs>>? = null

Dictionary of notifications associated with the budget. Budget can have up to five notifications.

Link copied to clipboard
val scope: Output<String>? = null

The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope.

Link copied to clipboard
val timeGrain: Output<Either<String, TimeGrainType>>? = null

The time covered by a budget. Tracking of the amount will be reset based on the time grain. BillingMonth, BillingQuarter, and BillingAnnual are only supported by WD customers

Link copied to clipboard
val timePeriod: Output<BudgetTimePeriodArgs>? = null

Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on the end date.

Functions

Link copied to clipboard
open override fun toJava(): BudgetArgs