Skip to content

Commit 2896a79

Browse files
BE-468: Changelog
1 parent ed51611 commit 2896a79

File tree

3 files changed

+112
-47
lines changed

3 files changed

+112
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## X.Y.Z (Unreleased)
2-
* Add new change notes here
2+
* **New Resource:** sumologic_scan_budget
33

44
## 3.0.1 (January 17, 2025)
55
**ENHANCEMENTS:**

sumologic/resource_sumologic_scan_budget_test.go

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ func TestAccSumologicScanBudget_basic(t *testing.T) {
3131
testWindow := "Query"
3232
testApplicableOn := "PerEntity"
3333
testGroupBy := "User"
34-
testAction := "StopScan"
35-
testScope := "j"
34+
testAction := "StopForeGroundScan"
3635
testStatus := "active"
3736

3837
resource.Test(t, resource.TestCase{
@@ -41,7 +40,7 @@ func TestAccSumologicScanBudget_basic(t *testing.T) {
4140
CheckDestroy: testAccCheckScanBudgetDestroy(scanBudget),
4241
Steps: []resource.TestStep{
4342
{
44-
Config: testAccCheckSumologicScanBudgetConfigImported(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testScope, testStatus),
43+
Config: testAccCheckSumologicScanBudgetConfigImported(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testStatus),
4544
},
4645
{
4746
ResourceName: "sumologic_scan_budget.foo",
@@ -61,8 +60,7 @@ func TestAccSumologicScanBudget_create(t *testing.T) {
6160
testWindow := "Query"
6261
testApplicableOn := "PerEntity"
6362
testGroupBy := "User"
64-
testAction := "StopScan"
65-
testScope := "j"
63+
testAction := "StopForeGroundScan"
6664
testStatus := "active"
6765

6866
resource.Test(t, resource.TestCase{
@@ -71,19 +69,18 @@ func TestAccSumologicScanBudget_create(t *testing.T) {
7169
CheckDestroy: testAccCheckScanBudgetDestroy(scanBudget),
7270
Steps: []resource.TestStep{
7371
{
74-
Config: testAccSumologicScanBudget(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testScope, testStatus),
72+
Config: testAccSumologicScanBudget(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testStatus),
7573
Check: resource.ComposeTestCheckFunc(
7674
testAccCheckScanBudgetExists("sumologic_scan_budget.test", &scanBudget, t),
7775
testAccCheckScanBudgetAttributes("sumologic_scan_budget.test"),
7876
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "name", testName),
7977
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "capacity", strconv.Itoa(testCapacity)),
8078
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "unit", testUnit),
81-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budgetType", testBudgetType),
79+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budget_type", testBudgetType),
8280
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "window", testWindow),
83-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicableOn", testApplicableOn),
84-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "groupBy", testGroupBy),
81+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicable_on", testApplicableOn),
82+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "group_by", testGroupBy),
8583
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "action", testAction),
86-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "scope", testScope),
8784
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "status", testStatus),
8885
),
8986
},
@@ -101,8 +98,7 @@ func TestAccSumologicScanBudget_update(t *testing.T) {
10198
testWindow := "Query"
10299
testApplicableOn := "PerEntity"
103100
testGroupBy := "User"
104-
testAction := "StopScan"
105-
testScope := "j"
101+
testAction := "StopForeGroundScan"
106102
testStatus := "active"
107103

108104
testUpdatedName := "Test Budget"
@@ -112,8 +108,7 @@ func TestAccSumologicScanBudget_update(t *testing.T) {
112108
testUpdatedWindow := "Daily"
113109
testUpdatedApplicableOn := "PerEntity"
114110
testUpdatedGroupBy := "User"
115-
testUpdatedAction := "StopScan"
116-
testUpdatedScope := "j"
111+
testUpdatedAction := "Warn"
117112
testUpdatedStatus := "active"
118113

119114
resource.Test(t, resource.TestCase{
@@ -122,34 +117,32 @@ func TestAccSumologicScanBudget_update(t *testing.T) {
122117
CheckDestroy: testAccCheckScanBudgetDestroy(scanBudget),
123118
Steps: []resource.TestStep{
124119
{
125-
Config: testAccSumologicScanBudget(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testScope, testStatus),
120+
Config: testAccSumologicScanBudget(testName, testCapacity, testUnit, testBudgetType, testWindow, testApplicableOn, testGroupBy, testAction, testStatus),
126121
Check: resource.ComposeTestCheckFunc(
127122
testAccCheckScanBudgetExists("sumologic_scan_budget.test", &scanBudget, t),
128123
testAccCheckScanBudgetAttributes("sumologic_scan_budget.test"),
129124
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "name", testName),
130125
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "capacity", strconv.Itoa(testCapacity)),
131126
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "unit", testUnit),
132-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budgetType", testBudgetType),
127+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budget_type", testBudgetType),
133128
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "window", testWindow),
134-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicableOn", testApplicableOn),
135-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "groupBy", testGroupBy),
129+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicable_on", testApplicableOn),
130+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "group_by", testGroupBy),
136131
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "action", testAction),
137-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "scope", testScope),
138132
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "status", testStatus),
139133
),
140134
},
141135
{
142-
Config: testAccSumologicScanBudgetUpdate(testUpdatedName, testUpdatedCapacity, testUpdatedUnit, testUpdatedBudgetType, testUpdatedWindow, testUpdatedApplicableOn, testUpdatedGroupBy, testUpdatedAction, testUpdatedScope, testUpdatedStatus),
136+
Config: testAccSumologicScanBudgetUpdate(testUpdatedName, testUpdatedCapacity, testUpdatedUnit, testUpdatedBudgetType, testUpdatedWindow, testUpdatedApplicableOn, testUpdatedGroupBy, testUpdatedAction, testUpdatedStatus),
143137
Check: resource.ComposeTestCheckFunc(
144138
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "name", testUpdatedName),
145139
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "capacity", strconv.Itoa(testUpdatedCapacity)),
146140
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "unit", testUpdatedUnit),
147-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budgetType", testUpdatedBudgetType),
141+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "budget_type", testUpdatedBudgetType),
148142
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "window", testUpdatedWindow),
149-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicableOn", testUpdatedApplicableOn),
150-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "groupBy", testUpdatedGroupBy),
143+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "applicable_on", testUpdatedApplicableOn),
144+
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "group_by", testUpdatedGroupBy),
151145
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "action", testUpdatedAction),
152-
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "scope", testUpdatedScope),
153146
resource.TestCheckResourceAttr("sumologic_scan_budget.test", "status", testUpdatedStatus),
154147
),
155148
},
@@ -197,55 +190,70 @@ func testAccCheckScanBudgetExists(name string, scanBudget *ScanBudget, t *testin
197190
return nil
198191
}
199192
}
200-
func testAccCheckSumologicScanBudgetConfigImported(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, scope string, status string) string {
193+
func testAccCheckSumologicScanBudgetConfigImported(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, status string) string {
201194
return fmt.Sprintf(`
202195
resource "sumologic_scan_budget" "foo" {
203196
name = "%s"
204197
capacity = %d
205198
unit = "%s"
206-
budgetType = "%s"
199+
budget_type = "%s"
207200
window = "%s"
208-
applicableOn = "%s"
209-
groupBy = "%s"
201+
applicable_on = "%s"
202+
group_by = "%s"
210203
action = "%s"
211-
scope = "%s"
204+
scope {
205+
included_users = ["000000000000011C"]
206+
excluded_users = []
207+
included_roles = []
208+
excluded_roles = ["0000000000000196"]
209+
}
212210
status = "%s"
213211
}
214-
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, scope, status)
212+
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, status)
215213
}
216214

217-
func testAccSumologicScanBudget(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, scope string, status string) string {
215+
func testAccSumologicScanBudget(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, status string) string {
218216
return fmt.Sprintf(`
219217
resource "sumologic_scan_budget" "test" {
220218
name = "%s"
221219
capacity = %d
222220
unit = "%s"
223-
budgetType = "%s"
221+
budget_type = "%s"
224222
window = "%s"
225-
applicableOn = "%s"
226-
groupBy = "%s"
223+
applicable_on = "%s"
224+
group_by = "%s"
227225
action = "%s"
228-
scope = "%s"
226+
scope {
227+
included_users = ["000000000000011C"]
228+
excluded_users = []
229+
included_roles = []
230+
excluded_roles = ["0000000000000196"]
231+
}
229232
status = "%s"
230233
}
231-
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, scope, status)
234+
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, status)
232235
}
233236

234-
func testAccSumologicScanBudgetUpdate(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, scope string, status string) string {
237+
func testAccSumologicScanBudgetUpdate(name string, capacity int, unit string, budgetType string, window string, applicableOn string, groupBy string, action string, status string) string {
235238
return fmt.Sprintf(`
236239
resource "sumologic_scan_budget" "test" {
237240
name = "%s"
238241
capacity = %d
239242
unit = "%s"
240-
budgetType = "%s"
243+
budget_type = "%s"
241244
window = "%s"
242-
applicableOn = "%s"
243-
groupBy = "%s"
245+
applicable_on = "%s"
246+
group_by = "%s"
244247
action = "%s"
245-
scope = "%s"
248+
scope {
249+
included_users = ["000000000000011C"]
250+
excluded_users = []
251+
included_roles = []
252+
excluded_roles = ["0000000000000196"]
253+
}
246254
status = "%s"
247255
}
248-
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, scope, status)
256+
`, name, capacity, unit, budgetType, window, applicableOn, groupBy, action, status)
249257
}
250258

251259
func testAccCheckScanBudgetAttributes(name string) resource.TestCheckFunc {
@@ -254,12 +262,11 @@ func testAccCheckScanBudgetAttributes(name string) resource.TestCheckFunc {
254262
resource.TestCheckResourceAttrSet(name, "name"),
255263
resource.TestCheckResourceAttrSet(name, "capacity"),
256264
resource.TestCheckResourceAttrSet(name, "unit"),
257-
resource.TestCheckResourceAttrSet(name, "budgetType"),
265+
resource.TestCheckResourceAttrSet(name, "budget_type"),
258266
resource.TestCheckResourceAttrSet(name, "window"),
259-
resource.TestCheckResourceAttrSet(name, "applicableOn"),
260-
resource.TestCheckResourceAttrSet(name, "groupBy"),
267+
resource.TestCheckResourceAttrSet(name, "applicable_on"),
268+
resource.TestCheckResourceAttrSet(name, "group_by"),
261269
resource.TestCheckResourceAttrSet(name, "action"),
262-
resource.TestCheckResourceAttrSet(name, "scope"),
263270
resource.TestCheckResourceAttrSet(name, "status"),
264271
)
265272
return f(s)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
layout: "sumologic"
3+
page_title: "SumoLogic: sumologic_scan_budget"
4+
description: |-
5+
Provides a Sumologic Scan Budget
6+
---
7+
8+
# sumologic_scan_budget
9+
Provides a [Sumologic Scan Budget][1].
10+
11+
## Example Usage
12+
```hcl
13+
resource "sumologic_scan_budget" "budget" {
14+
name = "TestBudget"
15+
capacity = 10
16+
unit = "GB"
17+
budget_type = "ScanBudget"
18+
window = "Query"
19+
applicable_on = "PerEntity"
20+
group_by = "User"
21+
action = "StopScan"
22+
status = "active"
23+
scope {
24+
included_users = ["000000000000011C"]
25+
excluded_users = []
26+
included_roles = []
27+
excluded_roles = ["0000000000000196"]
28+
}
29+
}
30+
```
31+
32+
## Argument Reference
33+
34+
The following arguments are supported:
35+
36+
* `name` - (Required) Display name of the scan budget. This must be unique across all the scan budgets.
37+
* `capacity` - (Required) Capacity of the scan budget. Only whole numbers are supported.
38+
* `unit` - (Required) Unit of the capacity. Supported values are: `MB`, `GB` and `TB`.
39+
* `budget_type` - (Required) Type of the budget. Supported values are: `ScanBudget`.
40+
* `window` - (Required) Window of the budget. Supported values are: `Query`, `Daily`, `Weekly` and `Monthly`.
41+
* `applicable_on` - (Required) Grouping of the budget. Supported values are: `PerEntity` and `Sum`.
42+
* `group_by` - (Required) Grouping Entity of the budget. Supported values are: `User`.
43+
* `action` - (Required) Action to be taken if the budget is breached. Supported values are: `StopForeGroundScan` and `Warn`.
44+
* `scope` - (Required) Scope of the budget.
45+
* `status` - (Required) Signifies the state of the budget. Supported values are: `active` and `inactive`.
46+
47+
The following attributes are exported:
48+
49+
* `id` - The internal ID of the budget.
50+
51+
## Import
52+
Scan budgets can be imported using the budget ID, e.g.:
53+
54+
```hcl
55+
terraform import sumologic_scan_budget.budget 00000000000123AB
56+
```
57+
58+
[1]: https://help.sumologic.com/docs/manage/manage-subscription/usage-management/

0 commit comments

Comments
 (0)