@@ -25,13 +25,14 @@ func TestAccSumologicS3Source_create(t *testing.T) {
2525 s3ResourceName := "sumologic_s3_source.s3"
2626 testAwsRoleArn := os .Getenv ("SUMOLOGIC_TEST_ROLE_ARN" )
2727 testAwsBucket := os .Getenv ("SUMOLOGIC_TEST_BUCKET_NAME" )
28+ useVersionedApi := true
2829 resource .Test (t , resource.TestCase {
2930 PreCheck : func () { testAccPreCheckWithAWS (t ) },
3031 Providers : testAccProviders ,
3132 CheckDestroy : testAccCheckS3SourceDestroy ,
3233 Steps : []resource.TestStep {
3334 {
34- Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket ),
35+ Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket , useVersionedApi ),
3536 Check : resource .ComposeTestCheckFunc (
3637 testAccCheckS3SourceExists (s3ResourceName , & s3Source ),
3738 testAccCheckS3SourceValues (& s3Source , sName , sDescription , sCategory ),
@@ -43,6 +44,7 @@ func TestAccSumologicS3Source_create(t *testing.T) {
4344 resource .TestCheckResourceAttr (s3ResourceName , "category" , sCategory ),
4445 resource .TestCheckResourceAttr (s3ResourceName , "content_type" , "AwsS3Bucket" ),
4546 resource .TestCheckResourceAttr (s3ResourceName , "path.0.type" , "S3BucketPathExpression" ),
47+ resource .TestCheckResourceAttr (s3ResourceName , "path.0.use_versioned_api" , "true" ),
4648 ),
4749 },
4850 },
@@ -56,13 +58,15 @@ func TestAccSumologicS3Source_update(t *testing.T) {
5658 s3ResourceName := "sumologic_s3_source.s3"
5759 testAwsRoleArn := os .Getenv ("SUMOLOGIC_TEST_ROLE_ARN" )
5860 testAwsBucket := os .Getenv ("SUMOLOGIC_TEST_BUCKET_NAME" )
61+ useVersionedApi := true
62+ useVersionedApiUpdated := false
5963 resource .Test (t , resource.TestCase {
6064 PreCheck : func () { testAccPreCheckWithAWS (t ) },
6165 Providers : testAccProviders ,
6266 CheckDestroy : testAccCheckHTTPSourceDestroy ,
6367 Steps : []resource.TestStep {
6468 {
65- Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket ),
69+ Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket , useVersionedApi ),
6670 Check : resource .ComposeTestCheckFunc (
6771 testAccCheckS3SourceExists (s3ResourceName , & s3Source ),
6872 testAccCheckS3SourceValues (& s3Source , sName , sDescription , sCategory ),
@@ -72,10 +76,11 @@ func TestAccSumologicS3Source_update(t *testing.T) {
7276 resource .TestCheckResourceAttr (s3ResourceName , "category" , sCategory ),
7377 resource .TestCheckResourceAttr (s3ResourceName , "content_type" , "AwsS3Bucket" ),
7478 resource .TestCheckResourceAttr (s3ResourceName , "path.0.type" , "S3BucketPathExpression" ),
79+ resource .TestCheckResourceAttr (s3ResourceName , "path.0.use_versioned_api" , "true" ),
7580 ),
7681 },
7782 {
78- Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sNameUpdated , sDescriptionUpdated , sCategoryUpdated , testAwsRoleArn , testAwsBucket ),
83+ Config : testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sNameUpdated , sDescriptionUpdated , sCategoryUpdated , testAwsRoleArn , testAwsBucket , useVersionedApiUpdated ),
7984 Check : resource .ComposeTestCheckFunc (
8085 testAccCheckS3SourceExists (s3ResourceName , & s3Source ),
8186 testAccCheckS3SourceValues (& s3Source , sNameUpdated , sDescriptionUpdated , sCategoryUpdated ),
@@ -85,6 +90,7 @@ func TestAccSumologicS3Source_update(t *testing.T) {
8590 resource .TestCheckResourceAttr (s3ResourceName , "category" , sCategoryUpdated ),
8691 resource .TestCheckResourceAttr (s3ResourceName , "content_type" , "AwsS3Bucket" ),
8792 resource .TestCheckResourceAttr (s3ResourceName , "path.0.type" , "S3BucketPathExpression" ),
93+ resource .TestCheckResourceAttr (s3ResourceName , "path.0.use_versioned_api" , "false" ),
8894 ),
8995 },
9096 },
@@ -157,7 +163,7 @@ func testAccCheckS3SourceValues(pollingSource *PollingSource, name, description,
157163 return nil
158164 }
159165}
160- func testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket string ) string {
166+ func testAccSumologicS3SourceConfig (cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket string , useVersionedApi bool ) string {
161167 return fmt .Sprintf (`
162168resource "sumologic_collector" "test" {
163169 name = "%s"
@@ -180,8 +186,9 @@ resource "sumologic_s3_source" "s3" {
180186 type = "S3BucketPathExpression"
181187 bucket_name = "%s"
182188 path_expression = "*"
189+ use_versioned_api = "%v"
183190 }
184191 }
185192
186- ` , cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket )
193+ ` , cName , cDescription , cCategory , sName , sDescription , sCategory , testAwsRoleArn , testAwsBucket , useVersionedApi )
187194}
0 commit comments