Skip to content

Commit d3f03b5

Browse files
authored
set authentication block in polling sources (#270)
* set authentication block in polling sources * fix incompatible type error * change auth in acceptance tests to use role ARN * set authentication block in polling sources * fix incompatible type error * change auth in acceptance tests to use role ARN * fix env error
1 parent 6f8d42d commit d3f03b5

11 files changed

+96
-103
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ jobs:
8282
SUMOLOGIC_ACCESSID: ${{ secrets.SUMOLOGIC_ACCESSID }}
8383
SUMOLOGIC_ACCESSKEY: ${{ secrets.SUMOLOGIC_ACCESSKEY }}
8484
SUMOLOGIC_ENVIRONMENT: ${{ secrets.SUMOLOGIC_ENVIRONMENT }}
85-
SUMOLOGIC_TEST_AWS_ID: ${{ secrets.SUMOLOGIC_TEST_AWS_ID }}
86-
SUMOLOGIC_TEST_AWS_KEY: ${{ secrets.SUMOLOGIC_TEST_AWS_KEY }}
8785
SUMOLOGIC_TEST_BUCKET_NAME: ${{ secrets.SUMOLOGIC_TEST_BUCKET_NAME }}
86+
SUMOLOGIC_TEST_ROLE_ARN: ${{ secrets.SUMOLOGIC_TEST_ROLE_ARN }}
8887

8988
run: |
9089
go test -v -cover ./sumologic/

sumologic/provider_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ func testAccPreCheck(t *testing.T) {
4242

4343
func testAccPreCheckWithAWS(t *testing.T) {
4444
testAccPreCheck(t)
45-
if v := os.Getenv("SUMOLOGIC_TEST_AWS_ID"); v == "" {
46-
t.Fatal("SUMOLOGIC_TEST_AWS_ID must be set for polling source acceptance tests")
47-
}
48-
if v := os.Getenv("SUMOLOGIC_TEST_AWS_KEY"); v == "" {
49-
t.Fatal("SUMOLOGIC_TEST_AWS_KEY must be set for polling source acceptance tests")
45+
if v := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN"); v == "" {
46+
t.Fatal("SUMOLOGIC_TEST_ROLE_ARN must be set for polling source acceptance tests")
5047
}
5148
if v := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME"); v == "" {
5249
t.Fatal("SUMOLOGIC_TEST_BUCKET_NAME must be set for polling source acceptance tests")

sumologic/resource_sumologic_cloudfront_source_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ func TestAccSumologicCloudFrontSource_create(t *testing.T) {
1616
cName, cDescription, cCategory := getRandomizedParams()
1717
sName, sDescription, sCategory := getRandomizedParams()
1818
cloudFrontResourceName := "sumologic_cloudfront_source.cloudfront"
19-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
20-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
19+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
2120
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
2221
resource.Test(t, resource.TestCase{
2322
PreCheck: func() { testAccPreCheckWithAWS(t) },
2423
Providers: testAccProviders,
2524
CheckDestroy: testAccCheckCloudFrontSourceDestroy,
2625
Steps: []resource.TestStep{
2726
{
28-
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
27+
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
2928
Check: resource.ComposeTestCheckFunc(
3029
testAccCheckCloudFrontSourceExists(cloudFrontResourceName, &cloudFrontSource),
3130
testAccCheckCloudFrontSourceValues(&cloudFrontSource, sName, sDescription, sCategory),
@@ -48,16 +47,15 @@ func TestAccSumologicCloudFrontSource_update(t *testing.T) {
4847
sName, sDescription, sCategory := getRandomizedParams()
4948
sNameUpdated, sDescriptionUpdated, sCategoryUpdated := getRandomizedParams()
5049
cloudFrontResourceName := "sumologic_cloudfront_source.cloudfront"
51-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
52-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
50+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
5351
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
5452
resource.Test(t, resource.TestCase{
5553
PreCheck: func() { testAccPreCheckWithAWS(t) },
5654
Providers: testAccProviders,
5755
CheckDestroy: testAccCheckHTTPSourceDestroy,
5856
Steps: []resource.TestStep{
5957
{
60-
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
58+
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
6159
Check: resource.ComposeTestCheckFunc(
6260
testAccCheckCloudFrontSourceExists(cloudFrontResourceName, &cloudFrontSource),
6361
testAccCheckCloudFrontSourceValues(&cloudFrontSource, sName, sDescription, sCategory),
@@ -70,7 +68,7 @@ func TestAccSumologicCloudFrontSource_update(t *testing.T) {
7068
),
7169
},
7270
{
73-
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsID, testAwsKey, testAwsBucket),
71+
Config: testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsRoleArn, testAwsBucket),
7472
Check: resource.ComposeTestCheckFunc(
7573
testAccCheckCloudFrontSourceExists(cloudFrontResourceName, &cloudFrontSource),
7674
testAccCheckCloudFrontSourceValues(&cloudFrontSource, sNameUpdated, sDescriptionUpdated, sCategoryUpdated),
@@ -152,7 +150,7 @@ func testAccCheckCloudFrontSourceValues(pollingSource *PollingSource, name, desc
152150
return nil
153151
}
154152
}
155-
func testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket string) string {
153+
func testAccSumologicCloudFrontSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket string) string {
156154
return fmt.Sprintf(`
157155
resource "sumologic_collector" "test" {
158156
name = "%s"
@@ -168,9 +166,8 @@ resource "sumologic_cloudfront_source" "cloudfront" {
168166
paused = false
169167
collector_id = "${sumologic_collector.test.id}"
170168
authentication {
171-
type = "S3BucketAuthentication"
172-
access_key = "%s"
173-
secret_key = "%s"
169+
type = "AWSRoleBasedAuthentication"
170+
role_arn = "%s"
174171
}
175172
path {
176173
type = "S3BucketPathExpression"
@@ -179,5 +176,5 @@ resource "sumologic_cloudfront_source" "cloudfront" {
179176
}
180177
}
181178
182-
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket)
179+
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket)
183180
}

sumologic/resource_sumologic_cloudtrail_source_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ func TestAccSumologicCloudTrailSource_create(t *testing.T) {
1616
cName, cDescription, cCategory := getRandomizedParams()
1717
sName, sDescription, sCategory := getRandomizedParams()
1818
cloudTrailResourceName := "sumologic_cloudtrail_source.cloudtrail"
19-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
20-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
19+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
2120
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
2221
resource.Test(t, resource.TestCase{
2322
PreCheck: func() { testAccPreCheckWithAWS(t) },
2423
Providers: testAccProviders,
2524
CheckDestroy: testAccCheckCloudTrailSourceDestroy,
2625
Steps: []resource.TestStep{
2726
{
28-
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
27+
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
2928
Check: resource.ComposeTestCheckFunc(
3029
testAccCheckCloudTrailSourceExists(cloudTrailResourceName, &cloudTrailSource),
3130
testAccCheckCloudTrailSourceValues(&cloudTrailSource, sName, sDescription, sCategory),
@@ -48,16 +47,15 @@ func TestAccSumologicCloudTrailSource_update(t *testing.T) {
4847
sName, sDescription, sCategory := getRandomizedParams()
4948
sNameUpdated, sDescriptionUpdated, sCategoryUpdated := getRandomizedParams()
5049
cloudTrailResourceName := "sumologic_cloudtrail_source.cloudtrail"
51-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
52-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
50+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
5351
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
5452
resource.Test(t, resource.TestCase{
5553
PreCheck: func() { testAccPreCheckWithAWS(t) },
5654
Providers: testAccProviders,
5755
CheckDestroy: testAccCheckHTTPSourceDestroy,
5856
Steps: []resource.TestStep{
5957
{
60-
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
58+
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
6159
Check: resource.ComposeTestCheckFunc(
6260
testAccCheckCloudTrailSourceExists(cloudTrailResourceName, &cloudTrailSource),
6361
testAccCheckCloudTrailSourceValues(&cloudTrailSource, sName, sDescription, sCategory),
@@ -70,7 +68,7 @@ func TestAccSumologicCloudTrailSource_update(t *testing.T) {
7068
),
7169
},
7270
{
73-
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsID, testAwsKey, testAwsBucket),
71+
Config: testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsRoleArn, testAwsBucket),
7472
Check: resource.ComposeTestCheckFunc(
7573
testAccCheckCloudTrailSourceExists(cloudTrailResourceName, &cloudTrailSource),
7674
testAccCheckCloudTrailSourceValues(&cloudTrailSource, sNameUpdated, sDescriptionUpdated, sCategoryUpdated),
@@ -152,7 +150,7 @@ func testAccCheckCloudTrailSourceValues(pollingSource *PollingSource, name, desc
152150
return nil
153151
}
154152
}
155-
func testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket string) string {
153+
func testAccSumologicCloudTrailSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket string) string {
156154
return fmt.Sprintf(`
157155
resource "sumologic_collector" "test" {
158156
name = "%s"
@@ -168,9 +166,8 @@ resource "sumologic_cloudtrail_source" "cloudtrail" {
168166
paused = false
169167
collector_id = "${sumologic_collector.test.id}"
170168
authentication {
171-
type = "S3BucketAuthentication"
172-
access_key = "%s"
173-
secret_key = "%s"
169+
type = "AWSRoleBasedAuthentication"
170+
role_arn = "%s"
174171
}
175172
path {
176173
type = "S3BucketPathExpression"
@@ -179,5 +176,5 @@ resource "sumologic_cloudtrail_source" "cloudtrail" {
179176
}
180177
}
181178
182-
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket)
179+
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket)
183180
}

sumologic/resource_sumologic_cloudwatch_source_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ func TestAccSumologicCloudWatchSource_create(t *testing.T) {
1616
cName, cDescription, cCategory := getRandomizedParams()
1717
sName, sDescription, sCategory := getRandomizedParams()
1818
cloudWatchResourceName := "sumologic_cloudwatch_source.cloudwatch"
19-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
20-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
19+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
2120
resource.Test(t, resource.TestCase{
2221
PreCheck: func() { testAccPreCheckWithAWS(t) },
2322
Providers: testAccProviders,
2423
CheckDestroy: testAccCheckCloudWatchSourceDestroy,
2524
Steps: []resource.TestStep{
2625
{
27-
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey),
26+
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn),
2827
Check: resource.ComposeTestCheckFunc(
2928
testAccCheckCloudWatchSourceExists(cloudWatchResourceName, &cloudWatchSource),
3029
testAccCheckCloudWatchSourceValues(&cloudWatchSource, sName, sDescription, sCategory),
@@ -47,15 +46,14 @@ func TestAccSumologicCloudWatchSource_update(t *testing.T) {
4746
sName, sDescription, sCategory := getRandomizedParams()
4847
sNameUpdated, sDescriptionUpdated, sCategoryUpdated := getRandomizedParams()
4948
cloudWatchResourceName := "sumologic_cloudwatch_source.cloudwatch"
50-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
51-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
49+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
5250
resource.Test(t, resource.TestCase{
5351
PreCheck: func() { testAccPreCheckWithAWS(t) },
5452
Providers: testAccProviders,
5553
CheckDestroy: testAccCheckHTTPSourceDestroy,
5654
Steps: []resource.TestStep{
5755
{
58-
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey),
56+
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn),
5957
Check: resource.ComposeTestCheckFunc(
6058
testAccCheckCloudWatchSourceExists(cloudWatchResourceName, &cloudWatchSource),
6159
testAccCheckCloudWatchSourceValues(&cloudWatchSource, sName, sDescription, sCategory),
@@ -68,7 +66,7 @@ func TestAccSumologicCloudWatchSource_update(t *testing.T) {
6866
),
6967
},
7068
{
71-
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsID, testAwsKey),
69+
Config: testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsRoleArn),
7270
Check: resource.ComposeTestCheckFunc(
7371
testAccCheckCloudWatchSourceExists(cloudWatchResourceName, &cloudWatchSource),
7472
testAccCheckCloudWatchSourceValues(&cloudWatchSource, sNameUpdated, sDescriptionUpdated, sCategoryUpdated),
@@ -150,7 +148,7 @@ func testAccCheckCloudWatchSourceValues(pollingSource *PollingSource, name, desc
150148
return nil
151149
}
152150
}
153-
func testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsId, testAwsKey string) string {
151+
func testAccSumologicCloudWatchSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn string) string {
154152
return fmt.Sprintf(`
155153
resource "sumologic_collector" "test" {
156154
name = "%s"
@@ -167,9 +165,8 @@ resource "sumologic_cloudwatch_source" "cloudwatch" {
167165
paused = false
168166
collector_id = "${sumologic_collector.test.id}"
169167
authentication {
170-
type = "S3BucketAuthentication"
171-
access_key = "%s"
172-
secret_key = "%s"
168+
type = "AWSRoleBasedAuthentication"
169+
role_arn = "%s"
173170
}
174171
path {
175172
type = "CloudWatchPath"
@@ -187,5 +184,5 @@ resource "sumologic_cloudwatch_source" "cloudwatch" {
187184
}
188185
}
189186
}
190-
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsId, testAwsKey)
187+
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn)
191188
}

sumologic/resource_sumologic_elb_source_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ func TestAccSumologicElbSource_create(t *testing.T) {
1616
cName, cDescription, cCategory := getRandomizedParams()
1717
sName, sDescription, sCategory := getRandomizedParams()
1818
elbResourceName := "sumologic_elb_source.elb"
19-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
20-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
19+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
2120
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
2221
resource.Test(t, resource.TestCase{
2322
PreCheck: func() { testAccPreCheckWithAWS(t) },
2423
Providers: testAccProviders,
2524
CheckDestroy: testAccCheckElbSourceDestroy,
2625
Steps: []resource.TestStep{
2726
{
28-
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
27+
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
2928
Check: resource.ComposeTestCheckFunc(
3029
testAccCheckElbSourceExists(elbResourceName, &elbSource),
3130
testAccCheckElbSourceValues(&elbSource, sName, sDescription, sCategory),
@@ -48,16 +47,15 @@ func TestAccSumologicElbSource_update(t *testing.T) {
4847
sName, sDescription, sCategory := getRandomizedParams()
4948
sNameUpdated, sDescriptionUpdated, sCategoryUpdated := getRandomizedParams()
5049
elbResourceName := "sumologic_elb_source.elb"
51-
testAwsID := os.Getenv("SUMOLOGIC_TEST_AWS_ID")
52-
testAwsKey := os.Getenv("SUMOLOGIC_TEST_AWS_KEY")
50+
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
5351
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
5452
resource.Test(t, resource.TestCase{
5553
PreCheck: func() { testAccPreCheckWithAWS(t) },
5654
Providers: testAccProviders,
5755
CheckDestroy: testAccCheckHTTPSourceDestroy,
5856
Steps: []resource.TestStep{
5957
{
60-
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket),
58+
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket),
6159
Check: resource.ComposeTestCheckFunc(
6260
testAccCheckElbSourceExists(elbResourceName, &elbSource),
6361
testAccCheckElbSourceValues(&elbSource, sName, sDescription, sCategory),
@@ -70,7 +68,7 @@ func TestAccSumologicElbSource_update(t *testing.T) {
7068
),
7169
},
7270
{
73-
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsID, testAwsKey, testAwsBucket),
71+
Config: testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sNameUpdated, sDescriptionUpdated, sCategoryUpdated, testAwsRoleArn, testAwsBucket),
7472
Check: resource.ComposeTestCheckFunc(
7573
testAccCheckElbSourceExists(elbResourceName, &elbSource),
7674
testAccCheckElbSourceValues(&elbSource, sNameUpdated, sDescriptionUpdated, sCategoryUpdated),
@@ -152,7 +150,7 @@ func testAccCheckElbSourceValues(pollingSource *PollingSource, name, description
152150
return nil
153151
}
154152
}
155-
func testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket string) string {
153+
func testAccSumologicElbSourceConfig(cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket string) string {
156154
return fmt.Sprintf(`
157155
resource "sumologic_collector" "test" {
158156
name = "%s"
@@ -168,9 +166,8 @@ resource "sumologic_elb_source" "elb" {
168166
paused = false
169167
collector_id = "${sumologic_collector.test.id}"
170168
authentication {
171-
type = "S3BucketAuthentication"
172-
access_key = "%s"
173-
secret_key = "%s"
169+
type = "AWSRoleBasedAuthentication"
170+
role_arn = "%s"
174171
}
175172
path {
176173
type = "S3BucketPathExpression"
@@ -179,5 +176,5 @@ resource "sumologic_elb_source" "elb" {
179176
}
180177
}
181178
182-
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsID, testAwsKey, testAwsBucket)
179+
`, cName, cDescription, cCategory, sName, sDescription, sCategory, testAwsRoleArn, testAwsBucket)
183180
}

sumologic/resource_sumologic_generic_polling_source.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ func resourceSumologicGenericPollingSourceRead(d *schema.ResourceData, meta inte
193193
return err
194194
}
195195

196+
authSettings := getPollingThirdPartyAuthenticationAttributes(pollingResources)
197+
if err := d.Set("authentication", authSettings); err != nil {
198+
return err
199+
}
200+
196201
if err := resourceSumologicSourceRead(d, source.Source); err != nil {
197202
return fmt.Errorf("%s", err)
198203
}
@@ -255,6 +260,22 @@ func getPollingThirdPartyPathAttributes(pollingResource []PollingResource) []map
255260
return s
256261
}
257262

263+
func getPollingThirdPartyAuthenticationAttributes(pollingResource []PollingResource) []map[string]interface{} {
264+
265+
var s []map[string]interface{}
266+
267+
for _, t := range pollingResource {
268+
mapping := map[string]interface{}{
269+
"type": t.Authentication.Type,
270+
"access_key": t.Authentication.AwsID,
271+
"secret_key": t.Authentication.AwsKey,
272+
"role_arn": t.Authentication.RoleARN,
273+
}
274+
s = append(s, mapping)
275+
}
276+
return s
277+
}
278+
258279
func flattenPollingTagFilters(v []TagFilter) []map[string]interface{} {
259280
var filters []map[string]interface{}
260281
for _, d := range v {

0 commit comments

Comments
 (0)