Skip to content

Commit 7f2aae9

Browse files
committed
Fix the use_versioned_api noise
1 parent b975978 commit 7f2aae9

5 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## X.Y.Z (Unreleased)
22
* Add new change notes here
33

4+
BUG FIXES:
5+
* Polling source paths without `use_versioned_api` will not show an incorrect diff in the `terraform plan`
6+
47
## 3.0.4 (February 4, 2025)
58
BUG FIXES:
69
* Fixed issue with release artifacts

sumologic/resource_sumologic_azure_event_hub_log_source_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func TestAccSumologicAzureEventHubLogSource_create(t *testing.T) {
4141
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "content_type", "AzureEventHubLog"),
4242
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "path.0.type", "AzureEventHubPath"),
4343
),
44-
ExpectNonEmptyPlan: true,
4544
},
4645
},
4746
})
@@ -75,7 +74,6 @@ func TestAccSumologicAzureEventHubLogSource_update(t *testing.T) {
7574
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "content_type", "AzureEventHubLog"),
7675
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "path.0.type", "AzureEventHubPath"),
7776
),
78-
ExpectNonEmptyPlan: true,
7977
},
8078
{
8179
Config: testAccSumologicAzureEventHubLogSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testSASKeyName, testSASKey, testNamespace, testEventHub, testConsumerGroup, testRegion),
@@ -89,7 +87,6 @@ func TestAccSumologicAzureEventHubLogSource_update(t *testing.T) {
8987
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "content_type", "AzureEventHubLog"),
9088
resource.TestCheckResourceAttr(azureEventHubLogResourceName, "path.0.type", "AzureEventHubPath"),
9189
),
92-
ExpectNonEmptyPlan: true,
9390
},
9491
},
9592
})

sumologic/resource_sumologic_cloudwatch_source_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func TestAccSumologicCloudWatchSource_create(t *testing.T) {
3636
resource.TestCheckResourceAttr(cloudWatchResourceName, "content_type", "AwsCloudWatch"),
3737
resource.TestCheckResourceAttr(cloudWatchResourceName, "path.0.type", "CloudWatchPath"),
3838
),
39-
ExpectNonEmptyPlan: true,
4039
},
4140
},
4241
})
@@ -65,7 +64,6 @@ func TestAccSumologicCloudWatchSource_update(t *testing.T) {
6564
resource.TestCheckResourceAttr(cloudWatchResourceName, "content_type", "AwsCloudWatch"),
6665
resource.TestCheckResourceAttr(cloudWatchResourceName, "path.0.type", "CloudWatchPath"),
6766
),
68-
ExpectNonEmptyPlan: true,
6967
},
7068
{
7169
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsRoleArn),
@@ -79,7 +77,6 @@ func TestAccSumologicCloudWatchSource_update(t *testing.T) {
7977
resource.TestCheckResourceAttr(cloudWatchResourceName, "content_type", "AwsCloudWatch"),
8078
resource.TestCheckResourceAttr(cloudWatchResourceName, "path.0.type", "CloudWatchPath"),
8179
),
82-
ExpectNonEmptyPlan: true,
8380
},
8481
},
8582
})

sumologic/resource_sumologic_gcp_metrics_source_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func TestAccSumologicGcpMetricsSource_create(t *testing.T) {
4747
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.custom_services.1.prefixes.0", customServicePrefix),
4848
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.custom_services.1.prefixes.1", "compute.googleapis.com/guest/"),
4949
),
50-
ExpectNonEmptyPlan: true,
5150
},
5251
},
5352
})
@@ -81,7 +80,6 @@ func TestAccSumologicGcpMetricsSource_update(t *testing.T) {
8180
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.type", "GcpMetricsPath"),
8281
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.custom_services.1.prefixes.0", customServicePrefix),
8382
),
84-
ExpectNonEmptyPlan: true,
8583
},
8684
{
8785
Config: testAccSumologicGcpMetricsSourceConfig(t, cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, updatedCustomServicePrefix),
@@ -96,7 +94,6 @@ func TestAccSumologicGcpMetricsSource_update(t *testing.T) {
9694
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.type", "GcpMetricsPath"),
9795
resource.TestCheckResourceAttr(GcpMetricsResourceName, "path.0.custom_services.1.prefixes.0", updatedCustomServicePrefix),
9896
),
99-
ExpectNonEmptyPlan: true,
10097
},
10198
},
10299
})

sumologic/resource_sumologic_generic_polling_source.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func resourceSumologicGenericPollingSource() *schema.Resource {
150150
"use_versioned_api": {
151151
Type: schema.TypeBool,
152152
Optional: true,
153-
Default: true,
153+
Default: nil,
154154
},
155155
"path_expression": {
156156
Type: schema.TypeString,
@@ -749,10 +749,14 @@ func getPollingPathSettings(d *schema.ResourceData) (PollingPath, error) {
749749
pathSettings.Type = "S3BucketPathExpression"
750750
pathSettings.BucketName = path["bucket_name"].(string)
751751
pathSettings.PathExpression = path["path_expression"].(string)
752-
if path["use_versioned_api"] != nil {
752+
753+
if isFieldSet(d, "path.0.use_versioned_api") {
753754
val := path["use_versioned_api"].(bool)
754755
pathSettings.UseVersionedApi = &val
756+
} else {
757+
pathSettings.UseVersionedApi = nil
755758
}
759+
756760
pathSettings.SnsTopicOrSubscriptionArn = getPollingSnsTopicOrSubscriptionArn(d)
757761
case "CloudWatchPath", "AwsInventoryPath":
758762
pathSettings.Type = pathType
@@ -818,3 +822,8 @@ func getPollingPathSettings(d *schema.ResourceData) (PollingPath, error) {
818822

819823
return pathSettings, nil
820824
}
825+
826+
func isFieldSet(d *schema.ResourceData, key string) bool {
827+
_, ok := d.GetOkExists(key)
828+
return ok
829+
}

0 commit comments

Comments
 (0)