Skip to content

Commit 2334bec

Browse files
committed
Add example usage for budget resource
1 parent 7fc8118 commit 2334bec

File tree

3 files changed

+177
-1
lines changed

3 files changed

+177
-1
lines changed

docs/resources/cost_budget.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,90 @@ description: |-
1010

1111
Provides a Datadog Cost Budget resource.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
resource "datadog_cost_budget" "example" {
17+
name = "My AWS Cost Budget"
18+
metrics_query = "sum:aws.cost.amortized{*}"
19+
start_month = 202401
20+
end_month = 202412
21+
22+
entries {
23+
amount = 1000
24+
month = 202401
25+
}
26+
entries {
27+
amount = 1000
28+
month = 202402
29+
}
30+
entries {
31+
amount = 1000
32+
month = 202403
33+
}
34+
entries {
35+
amount = 1000
36+
month = 202404
37+
}
38+
entries {
39+
amount = 1000
40+
month = 202405
41+
}
42+
entries {
43+
amount = 1000
44+
month = 202406
45+
}
46+
entries {
47+
amount = 1000
48+
month = 202407
49+
}
50+
entries {
51+
amount = 1000
52+
month = 202408
53+
}
54+
entries {
55+
amount = 1000
56+
month = 202409
57+
}
58+
entries {
59+
amount = 1000
60+
month = 202410
61+
}
62+
entries {
63+
amount = 1000
64+
month = 202411
65+
}
66+
entries {
67+
amount = 1000
68+
month = 202412
69+
}
70+
}
71+
72+
# Budget with tag filters
73+
resource "datadog_cost_budget" "example_with_filters" {
74+
name = "My Filtered Budget"
75+
metrics_query = "sum:aws.cost.amortized{*}"
76+
start_month = 202401
77+
end_month = 202412
78+
79+
entries {
80+
amount = 500
81+
month = 202401
82+
tag_filters {
83+
tag_key = "team"
84+
tag_value = "engineering"
85+
}
86+
}
87+
entries {
88+
amount = 500
89+
month = 202402
90+
tag_filters {
91+
tag_key = "team"
92+
tag_value = "engineering"
93+
}
94+
}
95+
}
96+
```
1497

1598
<!-- schema generated by tfplugindocs -->
1699
## Schema
@@ -50,3 +133,13 @@ Required:
50133

51134
- `tag_key` (String)
52135
- `tag_value` (String)
136+
137+
## Import
138+
139+
Import is supported using the following syntax:
140+
141+
The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:
142+
143+
```shell
144+
terraform import datadog_cost_budget.example budget-id-123
145+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
terraform import datadog_cost_budget.example budget-id-123
2+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
resource "datadog_cost_budget" "example" {
2+
name = "My AWS Cost Budget"
3+
metrics_query = "sum:aws.cost.amortized{*}"
4+
start_month = 202401
5+
end_month = 202412
6+
7+
entries {
8+
amount = 1000
9+
month = 202401
10+
}
11+
entries {
12+
amount = 1000
13+
month = 202402
14+
}
15+
entries {
16+
amount = 1000
17+
month = 202403
18+
}
19+
entries {
20+
amount = 1000
21+
month = 202404
22+
}
23+
entries {
24+
amount = 1000
25+
month = 202405
26+
}
27+
entries {
28+
amount = 1000
29+
month = 202406
30+
}
31+
entries {
32+
amount = 1000
33+
month = 202407
34+
}
35+
entries {
36+
amount = 1000
37+
month = 202408
38+
}
39+
entries {
40+
amount = 1000
41+
month = 202409
42+
}
43+
entries {
44+
amount = 1000
45+
month = 202410
46+
}
47+
entries {
48+
amount = 1000
49+
month = 202411
50+
}
51+
entries {
52+
amount = 1000
53+
month = 202412
54+
}
55+
}
56+
57+
# Budget with tag filters
58+
resource "datadog_cost_budget" "example_with_filters" {
59+
name = "My Filtered Budget"
60+
metrics_query = "sum:aws.cost.amortized{*}"
61+
start_month = 202401
62+
end_month = 202412
63+
64+
entries {
65+
amount = 500
66+
month = 202401
67+
tag_filters {
68+
tag_key = "account"
69+
tag_value = "ec2"
70+
}
71+
}
72+
entries {
73+
amount = 500
74+
month = 202402
75+
tag_filters {
76+
tag_key = "account"
77+
tag_value = "ec2"
78+
}
79+
}
80+
}
81+

0 commit comments

Comments
 (0)