@@ -12,33 +12,33 @@ import (
1212
1313func getTestParams () (string , string , string , string , string , string ) {
1414 dataForwardingResourceName := "sumologic_s3_data_forwarding_destination.test"
15- destinationName , description , region := getRandomizedDataForwardingParams ()
15+ destinationName , description := getRandomizedDataForwardingParams ()
1616 testAwsRoleArn := os .Getenv ("SUMOLOGIC_TEST_ROLE_ARN" )
1717 testAwsBucket := os .Getenv ("SUMOLOGIC_TEST_BUCKET_NAME" )
18- return dataForwardingResourceName , destinationName , description , region , testAwsRoleArn , testAwsBucket
18+ testAwsRegion := os .Getenv ("SUMOLOGIC_TEST_AWS_REGION" )
19+ return dataForwardingResourceName , destinationName , description , testAwsRegion , testAwsRoleArn , testAwsBucket
1920}
2021
21- func getRandomizedDataForwardingParams () (string , string , string ) {
22+ func getRandomizedDataForwardingParams () (string , string ) {
2223 destinationName := acctest .RandomWithPrefix ("tf-acc-test" )
2324 description := acctest .RandomWithPrefix ("tf-acc-test" )
24- region := acctest .RandomWithPrefix ("tf-acc-test" )
25- return destinationName , description , region
25+ return destinationName , description
2626}
2727
2828func TestAccSumologicDataForwarding_create (t * testing.T ) {
29- dataForwardingResourceName , destinationName , description , region , testAwsRoleArn , testAwsBucket := getTestParams ()
29+ dataForwardingResourceName , destinationName , description , testAwsRegion , testAwsRoleArn , testAwsBucket := getTestParams ()
3030 resource .Test (t , resource.TestCase {
3131 PreCheck : func () { testAccPreCheckWithAWS (t ) },
3232 Providers : testAccProviders ,
3333 CheckDestroy : testAccCheckDataForwardingDestroy (),
3434 Steps : []resource.TestStep {
3535 {
36- Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , region ),
36+ Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion ),
3737 Check : resource .ComposeTestCheckFunc (
3838 testAccCheckDataForwardingExists (),
3939 resource .TestCheckResourceAttr (dataForwardingResourceName , "destination_name" , destinationName ),
4040 resource .TestCheckResourceAttr (dataForwardingResourceName , "description" , description ),
41- resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , region ),
41+ resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , testAwsRegion ),
4242 resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_server_side_encryption" , "false" ),
4343 ),
4444 },
@@ -47,20 +47,20 @@ func TestAccSumologicDataForwarding_create(t *testing.T) {
4747}
4848
4949func TestAccSumologicDataForwarding_read (t * testing.T ) {
50- dataForwardingResourceName , destinationName , description , region , testAwsRoleArn , testAwsBucket := getTestParams ()
50+ dataForwardingResourceName , destinationName , description , testAwsRegion , testAwsRoleArn , testAwsBucket := getTestParams ()
5151 resource .Test (t , resource.TestCase {
5252 PreCheck : func () { testAccPreCheckWithAWS (t ) },
5353 Providers : testAccProviders ,
5454 CheckDestroy : testAccCheckDataForwardingDestroy (),
5555 Steps : []resource.TestStep {
5656 {
57- Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , region ),
57+ Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion ),
5858 Check : resource .ComposeTestCheckFunc (
5959 testAccCheckDataForwardingExists (),
6060 resource .TestCheckResourceAttr (dataForwardingResourceName , "destination_name" , destinationName ),
6161 resource .TestCheckResourceAttr (dataForwardingResourceName , "description" , description ),
6262 resource .TestCheckResourceAttr (dataForwardingResourceName , "bucket_name" , testAwsBucket ),
63- resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , region ),
63+ resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , testAwsRegion ),
6464 resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_server_side_encryption" , "false" ),
6565 ),
6666 },
@@ -73,28 +73,28 @@ func TestAccSumologicDataForwarding_read(t *testing.T) {
7373}
7474
7575func TestAccSumologicDataForwarding_update (t * testing.T ) {
76- dataForwardingResourceName , destinationName , description , region , testAwsRoleArn , testAwsBucket := getTestParams ()
76+ dataForwardingResourceName , destinationName , description , testAwsRegion , testAwsRoleArn , testAwsBucket := getTestParams ()
7777 resource .Test (t , resource.TestCase {
7878 PreCheck : func () { testAccPreCheckWithAWS (t ) },
7979 Providers : testAccProviders ,
8080 CheckDestroy : testAccCheckDataForwardingDestroy (),
8181 Steps : []resource.TestStep {
8282 {
83- Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , region ),
83+ Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion ),
8484 Check : resource .ComposeTestCheckFunc (
8585 testAccCheckDataForwardingExists (),
8686 resource .TestCheckResourceAttr (dataForwardingResourceName , "destination_name" , destinationName ),
8787 resource .TestCheckResourceAttr (dataForwardingResourceName , "description" , description ),
88- resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , region ),
88+ resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , testAwsRegion ),
8989 resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_server_side_encryption" , "false" ),
9090 ),
9191 }, {
92- Config : testAccSumologicDataForwardingUpdateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , region ),
92+ Config : testAccSumologicDataForwardingUpdateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion ),
9393 Check : resource .ComposeTestCheckFunc (
9494 testAccCheckDataForwardingExists (),
9595 resource .TestCheckResourceAttr (dataForwardingResourceName , "destination_name" , destinationName ),
9696 resource .TestCheckResourceAttr (dataForwardingResourceName , "description" , description ),
97- resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , region ),
97+ resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , testAwsRegion ),
9898 resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_server_side_encryption" , "true" ),
9999 ),
100100 },
@@ -104,19 +104,19 @@ func TestAccSumologicDataForwarding_update(t *testing.T) {
104104}
105105
106106func TestAccSumologicDataForwarding_delete (t * testing.T ) {
107- dataForwardingResourceName , destinationName , description , region , testAwsRoleArn , testAwsBucket := getTestParams ()
107+ dataForwardingResourceName , destinationName , description , testAwsRegion , testAwsRoleArn , testAwsBucket := getTestParams ()
108108 resource .Test (t , resource.TestCase {
109109 PreCheck : func () { testAccPreCheckWithAWS (t ) },
110110 Providers : testAccProviders ,
111111 CheckDestroy : testAccCheckDataForwardingDestroy (),
112112 Steps : []resource.TestStep {
113113 {
114- Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , region ),
114+ Config : testAccSumologicDataForwardingCreateConfig (destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion ),
115115 Check : resource .ComposeTestCheckFunc (
116116 testAccCheckDataForwardingExists (),
117117 resource .TestCheckResourceAttr (dataForwardingResourceName , "destination_name" , destinationName ),
118118 resource .TestCheckResourceAttr (dataForwardingResourceName , "description" , description ),
119- resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , region ),
119+ resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_region" , testAwsRegion ),
120120 resource .TestCheckResourceAttr (dataForwardingResourceName , "s3_server_side_encryption" , "false" ),
121121 ),
122122 }, {
@@ -163,7 +163,7 @@ func testAccCheckDataForwardingDestroy() resource.TestCheckFunc {
163163 }
164164}
165165
166- func testAccSumologicDataForwardingCreateConfig (destinationName string , description string , testAwsBucket string , testAwsRoleArn string , region string ) string {
166+ func testAccSumologicDataForwardingCreateConfig (destinationName string , description string , testAwsBucket string , testAwsRoleArn string , testAwsRegion string ) string {
167167 return fmt .Sprintf (`
168168resource "sumologic_s3_data_forwarding_destination" "test" {
169169 destination_name = "%s"
@@ -175,12 +175,11 @@ resource "sumologic_s3_data_forwarding_destination" "test" {
175175 }
176176 s3_region = "%s"
177177 s3_server_side_encryption = false
178-
179178}
180- ` , destinationName , description , testAwsBucket , testAwsRoleArn , region )
179+ ` , destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion )
181180}
182181
183- func testAccSumologicDataForwardingUpdateConfig (destinationName string , description string , testAwsBucket string , testAwsRoleArn string , region string ) string {
182+ func testAccSumologicDataForwardingUpdateConfig (destinationName string , description string , testAwsBucket string , testAwsRoleArn string , testAwsRegion string ) string {
184183 return fmt .Sprintf (`
185184resource "sumologic_s3_data_forwarding_destination" "test" {
186185 destination_name = "%s"
@@ -192,9 +191,8 @@ resource "sumologic_s3_data_forwarding_destination" "test" {
192191 }
193192 s3_region = "%s"
194193 s3_server_side_encryption = true
195-
196194}
197- ` , destinationName , description , testAwsBucket , testAwsRoleArn , region )
195+ ` , destinationName , description , testAwsBucket , testAwsRoleArn , testAwsRegion )
198196}
199197
200198func testAccSumologicDataForwardingDeleteConfig () string {
0 commit comments