Skip to content

Commit 29f1339

Browse files
authored
Merge branch 'master' into pgupta-terraform-monitor-tags-support
2 parents 4107541 + 2d22ca3 commit 29f1339

18 files changed

+780
-40
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
## 2.24.1 (Unreleased)
1+
## 2.25.1 (Unreleased)
2+
3+
## 2.25.0 (August 8, 2023)
24
FEATURES:
35
* **New Resource:** sumologic_metrics_search (GH-528)
46
* resource/sumologic_monitor: Added support for associating tags with a Monitor.
7+
* **New Resource:** sumologic_rum_source (GH-547)
8+
* Add `budgetType` support for sumologic_ingest_budget_v2 (GH-549)
59

610
BUG FIXES:
711
* Enforce non-empty string validation of `default_normalized_domain` and `domain_mappings` in cse_entity_normalization resource. (GH-540)
12+
* Fixes `sumologic_s3_source` to allow setting `use_versioned_api` parameter to `false`. (GH-555)
13+
14+
DEPRECATIONS:
15+
* resource_sumologic_ingest_budget : Deprecated in favour of `resource_sumologic_ingest_budget_v2`.
816

917
## 2.24.0 (June 22, 2023)
1018
FEATURES:

sumologic/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func Provider() terraform.ResourceProvider {
112112
"sumologic_local_file_source": resourceSumologicLocalFileSource(),
113113
"sumologic_log_search": resourceSumologicLogSearch(),
114114
"sumologic_metrics_search": resourceSumologicMetricsSearch(),
115+
"sumologic_rum_source": resourceSumologicRumSource(),
115116
},
116117
DataSourcesMap: map[string]*schema.Resource{
117118
"sumologic_cse_log_mapping_vendor_product": dataSourceCSELogMappingVendorAndProduct(),

sumologic/resource_sumologic_generic_polling_source.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ func resourceSumologicGenericPollingSource() *schema.Resource {
128128
"use_versioned_api": {
129129
Type: schema.TypeBool,
130130
Optional: true,
131+
Default: true,
132+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
133+
contentType := d.Get("content_type").(string)
134+
if contentType != "AwsS3Bucket" {
135+
return true
136+
}
137+
return false
138+
},
131139
},
132140
"path_expression": {
133141
Type: schema.TypeString,
@@ -578,7 +586,8 @@ func getPollingPathSettings(d *schema.ResourceData) (PollingPath, error) {
578586
pathSettings.BucketName = path["bucket_name"].(string)
579587
pathSettings.PathExpression = path["path_expression"].(string)
580588
if path["use_versioned_api"] != nil {
581-
pathSettings.UseVersionedApi = path["use_versioned_api"].(bool)
589+
val := path["use_versioned_api"].(bool)
590+
pathSettings.UseVersionedApi = &val
582591
}
583592
pathSettings.SnsTopicOrSubscriptionArn = getPollingSnsTopicOrSubscriptionArn(d)
584593
case "CloudWatchPath", "AwsInventoryPath":

sumologic/resource_sumologic_ingest_budget.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package sumologic
22

33
import (
4+
"log"
5+
46
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
57
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
6-
"log"
78
)
89

910
func resourceSumologicIngestBudget() *schema.Resource {
1011
return &schema.Resource{
11-
Create: resourceSumologicIngestBudgetCreate,
12-
Read: resourceSumologicIngestBudgetRead,
13-
Delete: resourceSumologicIngestBudgetDelete,
14-
Update: resourceSumologicIngestBudgetUpdate,
12+
DeprecationMessage: "Use resource_sumologic_ingest_budget_v2 instead.",
13+
Create: resourceSumologicIngestBudgetCreate,
14+
Read: resourceSumologicIngestBudgetRead,
15+
Delete: resourceSumologicIngestBudgetDelete,
16+
Update: resourceSumologicIngestBudgetUpdate,
1517
Importer: &schema.ResourceImporter{
1618
State: resourceSumologicIngestBudgetImport,
1719
},

sumologic/resource_sumologic_ingest_budget_v2.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ func resourceSumologicIngestBudgetV2() *schema.Resource {
7171
ForceNew: false,
7272
},
7373

74+
"budget_type": {
75+
Type: schema.TypeString,
76+
Optional: true,
77+
ForceNew: false,
78+
Default: "dailyVolume",
79+
},
80+
7481
"name": {
7582
Type: schema.TypeString,
7683
Required: true,
@@ -119,6 +126,7 @@ func resourceSumologicIngestBudgetV2Read(d *schema.ResourceData, meta interface{
119126
d.Set("description", ingestBudgetV2.Description)
120127
d.Set("action", ingestBudgetV2.Action)
121128
d.Set("capacity_bytes", ingestBudgetV2.CapacityBytes)
129+
d.Set("budget_type", ingestBudgetV2.BudgetType)
122130

123131
return nil
124132
}
@@ -150,6 +158,7 @@ func resourceToIngestBudgetV2(d *schema.ResourceData) IngestBudgetV2 {
150158
Timezone: d.Get("timezone").(string),
151159
ID: d.Id(),
152160
Action: d.Get("action").(string),
161+
BudgetType: d.Get("budget_type").(string),
153162
Description: d.Get("description").(string),
154163
AuditThreshold: d.Get("audit_threshold").(int),
155164
CapacityBytes: d.Get("capacity_bytes").(int),

sumologic/resource_sumologic_ingest_budget_v2_test.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ func TestAccSumologicIngestBudgetV2_basic(t *testing.T) {
3131
testDescription := "description-7hUwr"
3232
testAction := "stopCollecting"
3333
testCapacityBytes := 1000
34+
testBudgetType := "dailyVolume"
3435

3536
resource.Test(t, resource.TestCase{
3637
PreCheck: func() { testAccPreCheck(t) },
3738
Providers: testAccProviders,
3839
CheckDestroy: testAccCheckIngestBudgetV2Destroy(ingestBudgetV2),
3940
Steps: []resource.TestStep{
4041
{
41-
Config: testAccCheckSumologicIngestBudgetV2ConfigImported(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes),
42+
Config: testAccCheckSumologicIngestBudgetV2ConfigImported(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes, testBudgetType),
4243
},
4344
{
4445
ResourceName: "sumologic_ingest_budget_v2.foo",
@@ -58,13 +59,14 @@ func TestAccSumologicIngestBudgetV2_create(t *testing.T) {
5859
testDescription := "description-900AB"
5960
testAction := "stopCollecting"
6061
testCapacityBytes := 1000
62+
testBudgetType := "dailyVolume"
6163
resource.Test(t, resource.TestCase{
6264
PreCheck: func() { testAccPreCheck(t) },
6365
Providers: testAccProviders,
6466
CheckDestroy: testAccCheckIngestBudgetV2Destroy(ingestBudgetV2),
6567
Steps: []resource.TestStep{
6668
{
67-
Config: testAccSumologicIngestBudgetV2(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes),
69+
Config: testAccSumologicIngestBudgetV2(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes, testBudgetType),
6870
Check: resource.ComposeTestCheckFunc(
6971
testAccCheckIngestBudgetV2Exists("sumologic_ingest_budget_v2.test", &ingestBudgetV2, t),
7072
testAccCheckIngestBudgetV2Attributes("sumologic_ingest_budget_v2.test"),
@@ -76,6 +78,7 @@ func TestAccSumologicIngestBudgetV2_create(t *testing.T) {
7678
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "description", testDescription),
7779
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "action", testAction),
7880
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "capacity_bytes", strconv.Itoa(testCapacityBytes)),
81+
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "budget_type", testBudgetType),
7982
),
8083
},
8184
},
@@ -92,6 +95,7 @@ func TestAccSumologicIngestBudgetV2_update(t *testing.T) {
9295
testDescription := "description-2tAk8"
9396
testAction := "stopCollecting"
9497
testCapacityBytes := 1000
98+
testBudgetType := "dailyVolume"
9599

96100
testUpdatedName := "Developer BudgetUpdate"
97101
testUpdatedScope := "_sourceCategory=*prod*nginx*Update"
@@ -101,14 +105,15 @@ func TestAccSumologicIngestBudgetV2_update(t *testing.T) {
101105
testUpdatedDescription := "description-pY8kDUpdate"
102106
testUpdatedAction := "keepCollecting"
103107
testUpdatedCapacityBytes := 1001
108+
testUpdatedBudgetType := "dailyVolume"
104109

105110
resource.Test(t, resource.TestCase{
106111
PreCheck: func() { testAccPreCheck(t) },
107112
Providers: testAccProviders,
108113
CheckDestroy: testAccCheckIngestBudgetV2Destroy(ingestBudgetV2),
109114
Steps: []resource.TestStep{
110115
{
111-
Config: testAccSumologicIngestBudgetV2(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes),
116+
Config: testAccSumologicIngestBudgetV2(testName, testScope, testTimezone, testResetTime, testAuditThreshold, testDescription, testAction, testCapacityBytes, testBudgetType),
112117
Check: resource.ComposeTestCheckFunc(
113118
testAccCheckIngestBudgetV2Exists("sumologic_ingest_budget_v2.test", &ingestBudgetV2, t),
114119
testAccCheckIngestBudgetV2Attributes("sumologic_ingest_budget_v2.test"),
@@ -120,10 +125,11 @@ func TestAccSumologicIngestBudgetV2_update(t *testing.T) {
120125
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "description", testDescription),
121126
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "action", testAction),
122127
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "capacity_bytes", strconv.Itoa(testCapacityBytes)),
128+
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "budget_type", testBudgetType),
123129
),
124130
},
125131
{
126-
Config: testAccSumologicIngestBudgetV2Update(testUpdatedName, testUpdatedScope, testUpdatedTimezone, testUpdatedResetTime, testUpdatedAuditThreshold, testUpdatedDescription, testUpdatedAction, testUpdatedCapacityBytes),
132+
Config: testAccSumologicIngestBudgetV2Update(testUpdatedName, testUpdatedScope, testUpdatedTimezone, testUpdatedResetTime, testUpdatedAuditThreshold, testUpdatedDescription, testUpdatedAction, testUpdatedCapacityBytes, testUpdatedBudgetType),
127133
Check: resource.ComposeTestCheckFunc(
128134
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "name", testUpdatedName),
129135
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "scope", testUpdatedScope),
@@ -133,6 +139,7 @@ func TestAccSumologicIngestBudgetV2_update(t *testing.T) {
133139
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "description", testUpdatedDescription),
134140
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "action", testUpdatedAction),
135141
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "capacity_bytes", strconv.Itoa(testUpdatedCapacityBytes)),
142+
resource.TestCheckResourceAttr("sumologic_ingest_budget_v2.test", "budget_type", testUpdatedBudgetType),
136143
),
137144
},
138145
},
@@ -179,7 +186,7 @@ func testAccCheckIngestBudgetV2Exists(name string, ingestBudgetV2 *IngestBudgetV
179186
return nil
180187
}
181188
}
182-
func testAccCheckSumologicIngestBudgetV2ConfigImported(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int) string {
189+
func testAccCheckSumologicIngestBudgetV2ConfigImported(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int, budgetType string) string {
183190
return fmt.Sprintf(`
184191
resource "sumologic_ingest_budget_v2" "foo" {
185192
name = "%s"
@@ -190,11 +197,12 @@ resource "sumologic_ingest_budget_v2" "foo" {
190197
description = "%s"
191198
action = "%s"
192199
capacity_bytes = %d
200+
budget_type = "%s"
193201
}
194-
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes)
202+
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes, budgetType)
195203
}
196204

197-
func testAccSumologicIngestBudgetV2(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int) string {
205+
func testAccSumologicIngestBudgetV2(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int, budgetType string) string {
198206
return fmt.Sprintf(`
199207
resource "sumologic_ingest_budget_v2" "test" {
200208
name = "%s"
@@ -205,11 +213,12 @@ resource "sumologic_ingest_budget_v2" "test" {
205213
description = "%s"
206214
action = "%s"
207215
capacity_bytes = %d
216+
budget_type = "%s"
208217
}
209-
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes)
218+
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes, budgetType)
210219
}
211220

212-
func testAccSumologicIngestBudgetV2Update(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int) string {
221+
func testAccSumologicIngestBudgetV2Update(name string, scope string, timezone string, resetTime string, auditThreshold int, description string, action string, capacityBytes int, budgetType string) string {
213222
return fmt.Sprintf(`
214223
resource "sumologic_ingest_budget_v2" "test" {
215224
name = "%s"
@@ -220,8 +229,9 @@ resource "sumologic_ingest_budget_v2" "test" {
220229
description = "%s"
221230
action = "%s"
222231
capacity_bytes = %d
232+
budget_type = "%s"
223233
}
224-
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes)
234+
`, name, scope, timezone, resetTime, auditThreshold, description, action, capacityBytes, budgetType)
225235
}
226236

227237
func testAccCheckIngestBudgetV2Attributes(name string) resource.TestCheckFunc {
@@ -234,6 +244,7 @@ func testAccCheckIngestBudgetV2Attributes(name string) resource.TestCheckFunc {
234244
resource.TestCheckResourceAttrSet(name, "audit_threshold"),
235245
resource.TestCheckResourceAttrSet(name, "description"),
236246
resource.TestCheckResourceAttrSet(name, "action"),
247+
resource.TestCheckResourceAttrSet(name, "budget_type"),
237248
resource.TestCheckResourceAttrSet(name, "capacity_bytes"),
238249
)
239250
return f(s)

0 commit comments

Comments
 (0)