-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
52 lines (42 loc) · 1.13 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Provides configuration details for Terraform.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.93.1"
}
}
}
# Provides configuration details for the Azure Terraform provider
provider "azurerm" {
features {}
}
data "azurerm_subscription" "current" {
}
output "current_subscription_display_name" {
value = data.azurerm_subscription.current.display_name
}
# Create a budget for the subscription
resource "azurerm_consumption_budget_subscription" "example" {
name = "Budget"
subscription_id = data.azurerm_subscription.current.id
amount = var.budget-amount
time_grain = "Monthly"
time_period {
start_date = "2022-01-01T00:00:00Z"
end_date = "2023-12-31T00:00:00Z"
}
notification {
enabled = true
threshold = var.notification-threshold-equalto
operator = "EqualTo"
contact_emails = var.email-address
}
notification {
enabled = true
threshold = var.notification-threshold-forecasted
operator = "GreaterThan"
threshold_type = "Forecasted"
contact_emails = var.email-address
}
}