From 568483c2a85a72e4f740b910141dcd0f2a5cf4bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 01/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 5273c73ef1b1f4f8fb03893c31be4658fdee0df6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 02/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From f2c5be9e12473a0ca4757728b16c0f4d00a468e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 03/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 1e48317b9e5c9e3b662ba87da88c07f08337c672 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 04/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 98e41cebc70532c5911392c985f9d9b170d651ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 05/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 598e773dad9831dca48bc0da716712a7469a2e08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 06/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 15ec17cb671c2a026440bb71343a6c9e23cd8fd8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 07/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 ++++++++++++++++++++- aws/resource_aws_securityhub_test.go | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index 20ceb386108..cd2ebb034c7 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 23862a53ca4..d2a9f2d02da 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,6 +37,32 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } +func testAccAWSSecurityHubMember_email(t *testing.T) { + var member securityhub.Member + resourceName := "aws_securityhub_member.example" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityHubMemberExists(resourceName, &member), + resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -125,7 +151,18 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { + return fmt.Sprintf(` +resource "aws_securityhub_account" "example" {} + +resource "aws_securityhub_member" "example" { + depends_on = [aws_securityhub_account.example] + account_id = "%s" +} +`, accountId) +} + +func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index ee4601b8d31..20f4ff6e19b 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,6 +11,7 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, + "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From bc225f5f51b8606203ef44fe3cfa61aeccf828e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 08/17] f/aws_securityhub_member: email is optional variable --- aws/resource_aws_securityhub_member.go | 2 +- aws/resource_aws_securityhub_member_test.go | 41 +-------------------- aws/resource_aws_securityhub_test.go | 1 - 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/aws/resource_aws_securityhub_member.go b/aws/resource_aws_securityhub_member.go index cd2ebb034c7..20ceb386108 100644 --- a/aws/resource_aws_securityhub_member.go +++ b/aws/resource_aws_securityhub_member.go @@ -38,7 +38,7 @@ func resourceAwsSecurityHubMember() *schema.Resource { }, "email": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, }, "invite": { diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index d2a9f2d02da..23862a53ca4 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -23,7 +23,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSecurityHubMemberConfig_basic("111111111111"), + Config: testAccAWSSecurityHubMemberConfig_basic("111111111111", "example@example.com"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityHubMemberExists(resourceName, &member), ), @@ -37,32 +37,6 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { }) } -func testAccAWSSecurityHubMember_email(t *testing.T) { - var member securityhub.Member - resourceName := "aws_securityhub_member.example" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSSecurityHubMemberConfig_email("111111111111", "example@example.com"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSecurityHubMemberExists(resourceName, &member), - resource.TestCheckResourceAttr(resourceName, "email", "example@example.com"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func testAccAWSSecurityHubMember_invite(t *testing.T) { var member securityhub.Member resourceName := "aws_securityhub_member.example" @@ -151,18 +125,7 @@ func testAccCheckAWSSecurityHubMemberDestroy(s *terraform.State) error { return nil } -func testAccAWSSecurityHubMemberConfig_basic(accountId string) string { - return fmt.Sprintf(` -resource "aws_securityhub_account" "example" {} - -resource "aws_securityhub_member" "example" { - depends_on = [aws_securityhub_account.example] - account_id = "%s" -} -`, accountId) -} - -func testAccAWSSecurityHubMemberConfig_email(accountId, email string) string { +func testAccAWSSecurityHubMemberConfig_basic(accountId, email string) string { return fmt.Sprintf(` resource "aws_securityhub_account" "example" {} diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index 20f4ff6e19b..ee4601b8d31 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -11,7 +11,6 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { }, "Member": { "basic": testAccAWSSecurityHubMember_basic, - "email": testAccAWSSecurityHubMember_email, "invite": testAccAWSSecurityHubMember_invite, }, "ActionTarget": { From 914367c85f53e3ff1a79bc711d74c837ca747624 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 1 May 2021 17:16:06 +0530 Subject: [PATCH 09/17] f/resource_aws_datasync_location_s3 --- aws/resource_aws_datasync_location_s3.go | 11 ++++ aws/resource_aws_datasync_location_s3_test.go | 52 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 03fc43d3923..500d6f8e2dd 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -51,6 +51,12 @@ func resourceAwsDataSyncLocationS3() *schema.Resource { }, }, }, + "s3_storage_class": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(datasync.S3StorageClass_Values(), false), + }, "subdirectory": { Type: schema.TypeString, Required: true, @@ -90,6 +96,10 @@ func resourceAwsDataSyncLocationS3Create(d *schema.ResourceData, meta interface{ Tags: tags.IgnoreAws().DatasyncTags(), } + if v, ok := d.GetOk("s3_storage_class"); ok { + input.S3StorageClass = aws.String(v.(string)) + } + log.Printf("[DEBUG] Creating DataSync Location S3: %s", input) var output *datasync.CreateLocationS3Output @@ -165,6 +175,7 @@ func resourceAwsDataSyncLocationS3Read(d *schema.ResourceData, meta interface{}) d.Set("subdirectory", subdirectory) d.Set("uri", output.LocationUri) + d.Set("s3_storage_class", output.S3StorageClass) tags, err := keyvaluetags.DatasyncListTags(conn, d.Id()) diff --git a/aws/resource_aws_datasync_location_s3_test.go b/aws/resource_aws_datasync_location_s3_test.go index 27a528b3205..e38060a8c16 100644 --- a/aws/resource_aws_datasync_location_s3_test.go +++ b/aws/resource_aws_datasync_location_s3_test.go @@ -115,6 +115,42 @@ func TestAccAWSDataSyncLocationS3_basic(t *testing.T) { }) } +func TestAccAWSDataSyncLocationS3_storageclass(t *testing.T) { + var locationS31 datasync.DescribeLocationS3Output + rName := acctest.RandomWithPrefix("tf-acc-test") + iamRoleResourceName := "aws_iam_role.test" + resourceName := "aws_datasync_location_s3.test" + s3BucketResourceName := "aws_s3_bucket.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDataSyncLocationS3Destroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDataSyncLocationS3ConfigStorageClass(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDataSyncLocationS3Exists(resourceName, &locationS31), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "datasync", regexp.MustCompile(`location/loc-.+`)), + resource.TestCheckResourceAttrPair(resourceName, "s3_bucket_arn", s3BucketResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "s3_config.#", "1"), + resource.TestCheckResourceAttrPair(resourceName, "s3_config.0.bucket_access_role_arn", iamRoleResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "subdirectory", "/test/"), + resource.TestCheckResourceAttr(resourceName, "s3_storage_class", "STANDARD_IA"), + resource.TestMatchResourceAttr(resourceName, "uri", regexp.MustCompile(`^s3://.+/`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"s3_bucket_arn"}, + }, + }, + }) +} + func TestAccAWSDataSyncLocationS3_disappears(t *testing.T) { var locationS31 datasync.DescribeLocationS3Output rName := acctest.RandomWithPrefix("tf-acc-test") @@ -326,6 +362,22 @@ resource "aws_datasync_location_s3" "test" { ` } +func testAccAWSDataSyncLocationS3ConfigStorageClass(rName string) string { + return testAccAWSDataSyncLocationS3ConfigBase(rName) + ` +resource "aws_datasync_location_s3" "test" { + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" + s3_storage_class = "STANDARD_IA" + + s3_config { + bucket_access_role_arn = aws_iam_role.test.arn + } + + depends_on = [aws_iam_role_policy.test] +} +` +} + func testAccAWSDataSyncLocationS3ConfigTags1(rName, key1, value1 string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + fmt.Sprintf(` resource "aws_datasync_location_s3" "test" { From 2efebe62a884d3c1d47d71e1e1040bc7feb3263d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 1 May 2021 17:23:49 +0530 Subject: [PATCH 10/17] f/resource_aws_datasync_location_s3 --- aws/resource_aws_datasync_location_s3.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 500d6f8e2dd..49f7c26c1d2 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -55,6 +55,7 @@ func resourceAwsDataSyncLocationS3() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + Default: datasync.S3StorageClassStandard, ValidateFunc: validation.StringInSlice(datasync.S3StorageClass_Values(), false), }, "subdirectory": { @@ -90,14 +91,11 @@ func resourceAwsDataSyncLocationS3Create(d *schema.ResourceData, meta interface{ tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &datasync.CreateLocationS3Input{ - S3BucketArn: aws.String(d.Get("s3_bucket_arn").(string)), - S3Config: expandDataSyncS3Config(d.Get("s3_config").([]interface{})), - Subdirectory: aws.String(d.Get("subdirectory").(string)), - Tags: tags.IgnoreAws().DatasyncTags(), - } - - if v, ok := d.GetOk("s3_storage_class"); ok { - input.S3StorageClass = aws.String(v.(string)) + S3BucketArn: aws.String(d.Get("s3_bucket_arn").(string)), + S3Config: expandDataSyncS3Config(d.Get("s3_config").([]interface{})), + S3StorageClass: aws.String(d.Get("s3_storage_class").(string)), + Subdirectory: aws.String(d.Get("subdirectory").(string)), + Tags: tags.IgnoreAws().DatasyncTags(), } log.Printf("[DEBUG] Creating DataSync Location S3: %s", input) From d8120248217e67d143cc2353b2c87b8024e09b15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 1 May 2021 18:21:46 +0530 Subject: [PATCH 11/17] f/resource_aws_datasync_location_s3 --- aws/resource_aws_datasync_location_s3.go | 3 +-- aws/resource_aws_datasync_location_s3_test.go | 15 +++++++++------ website/docs/r/datasync_location_s3.html.markdown | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 49f7c26c1d2..ade39e66d6b 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -53,9 +53,8 @@ func resourceAwsDataSyncLocationS3() *schema.Resource { }, "s3_storage_class": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, - Default: datasync.S3StorageClassStandard, ValidateFunc: validation.StringInSlice(datasync.S3StorageClass_Values(), false), }, "subdirectory": { diff --git a/aws/resource_aws_datasync_location_s3_test.go b/aws/resource_aws_datasync_location_s3_test.go index e38060a8c16..108df561a11 100644 --- a/aws/resource_aws_datasync_location_s3_test.go +++ b/aws/resource_aws_datasync_location_s3_test.go @@ -350,8 +350,9 @@ resource "aws_s3_bucket" "test" { func testAccAWSDataSyncLocationS3Config(rName string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + ` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" + s3_storage_class = "STANDARD" s3_config { bucket_access_role_arn = aws_iam_role.test.arn @@ -381,8 +382,9 @@ resource "aws_datasync_location_s3" "test" { func testAccAWSDataSyncLocationS3ConfigTags1(rName, key1, value1 string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + fmt.Sprintf(` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" + s3_storage_class = "STANDARD" s3_config { bucket_access_role_arn = aws_iam_role.test.arn @@ -400,8 +402,9 @@ resource "aws_datasync_location_s3" "test" { func testAccAWSDataSyncLocationS3ConfigTags2(rName, key1, value1, key2, value2 string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + fmt.Sprintf(` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" + s3_storage_class = "STANDARD" s3_config { bucket_access_role_arn = aws_iam_role.test.arn diff --git a/website/docs/r/datasync_location_s3.html.markdown b/website/docs/r/datasync_location_s3.html.markdown index 467f4858b7d..40b880e963e 100644 --- a/website/docs/r/datasync_location_s3.html.markdown +++ b/website/docs/r/datasync_location_s3.html.markdown @@ -29,6 +29,7 @@ The following arguments are supported: * `s3_bucket_arn` - (Required) Amazon Resource Name (ARN) of the S3 Bucket. * `s3_config` - (Required) Configuration block containing information for connecting to S3. +* `s3_storage_class` - (Required) Configuration block containing information about S3 storage class.[valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) * `subdirectory` - (Required) Prefix to perform actions as source or destination. * `tags` - (Optional) Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From fd15a63e9b13b8361ef7eb16520a623779eced09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 May 2021 20:02:21 +0530 Subject: [PATCH 12/17] f/resource_aws_datasync_location_s3 --- aws/resource_aws_datasync_location_s3.go | 3 ++- aws/resource_aws_datasync_location_s3_test.go | 15 ++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index ade39e66d6b..67d7bbc3ec0 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -53,7 +53,8 @@ func resourceAwsDataSyncLocationS3() *schema.Resource { }, "s3_storage_class": { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, ForceNew: true, ValidateFunc: validation.StringInSlice(datasync.S3StorageClass_Values(), false), }, diff --git a/aws/resource_aws_datasync_location_s3_test.go b/aws/resource_aws_datasync_location_s3_test.go index 108df561a11..e38060a8c16 100644 --- a/aws/resource_aws_datasync_location_s3_test.go +++ b/aws/resource_aws_datasync_location_s3_test.go @@ -350,9 +350,8 @@ resource "aws_s3_bucket" "test" { func testAccAWSDataSyncLocationS3Config(rName string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + ` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" - s3_storage_class = "STANDARD" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" s3_config { bucket_access_role_arn = aws_iam_role.test.arn @@ -382,9 +381,8 @@ resource "aws_datasync_location_s3" "test" { func testAccAWSDataSyncLocationS3ConfigTags1(rName, key1, value1 string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + fmt.Sprintf(` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" - s3_storage_class = "STANDARD" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" s3_config { bucket_access_role_arn = aws_iam_role.test.arn @@ -402,9 +400,8 @@ resource "aws_datasync_location_s3" "test" { func testAccAWSDataSyncLocationS3ConfigTags2(rName, key1, value1, key2, value2 string) string { return testAccAWSDataSyncLocationS3ConfigBase(rName) + fmt.Sprintf(` resource "aws_datasync_location_s3" "test" { - s3_bucket_arn = aws_s3_bucket.test.arn - subdirectory = "/test" - s3_storage_class = "STANDARD" + s3_bucket_arn = aws_s3_bucket.test.arn + subdirectory = "/test" s3_config { bucket_access_role_arn = aws_iam_role.test.arn From 97eb9dc77410b38ce2995c97483ad51f76664b81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 May 2021 20:04:05 +0530 Subject: [PATCH 13/17] resource/aws_elasticache_global_replication_group: Remove deprecated parameter actual_engine_version --- website/docs/r/datasync_location_s3.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/datasync_location_s3.html.markdown b/website/docs/r/datasync_location_s3.html.markdown index 40b880e963e..76dba7f56f4 100644 --- a/website/docs/r/datasync_location_s3.html.markdown +++ b/website/docs/r/datasync_location_s3.html.markdown @@ -29,7 +29,7 @@ The following arguments are supported: * `s3_bucket_arn` - (Required) Amazon Resource Name (ARN) of the S3 Bucket. * `s3_config` - (Required) Configuration block containing information for connecting to S3. -* `s3_storage_class` - (Required) Configuration block containing information about S3 storage class.[valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) +* `s3_storage_class` - (Optional) Configuration block containing information about S3 storage class.[valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) * `subdirectory` - (Required) Prefix to perform actions as source or destination. * `tags` - (Optional) Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From 6ce1e8518081862739f4eca2e596e167e6ed2697 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 May 2021 20:14:10 +0530 Subject: [PATCH 14/17] resource/aws_elasticache_global_replication_group: Remove deprecated parameter actual_engine_version --- aws/resource_aws_datasync_location_s3.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 67d7bbc3ec0..319e0e2b4d8 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -93,11 +93,14 @@ func resourceAwsDataSyncLocationS3Create(d *schema.ResourceData, meta interface{ input := &datasync.CreateLocationS3Input{ S3BucketArn: aws.String(d.Get("s3_bucket_arn").(string)), S3Config: expandDataSyncS3Config(d.Get("s3_config").([]interface{})), - S3StorageClass: aws.String(d.Get("s3_storage_class").(string)), Subdirectory: aws.String(d.Get("subdirectory").(string)), Tags: tags.IgnoreAws().DatasyncTags(), } + if v, ok := d.GetOk("s3_storage_class"); ok { + input.S3StorageClass = aws.String(v.(string)) + } + log.Printf("[DEBUG] Creating DataSync Location S3: %s", input) var output *datasync.CreateLocationS3Output From 230b1d4ebdabb3eca8f74d9ebe05d455e359a700 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 May 2021 20:15:07 +0530 Subject: [PATCH 15/17] resource/aws_elasticache_global_replication_group: Remove deprecated parameter actual_engine_version --- aws/resource_aws_datasync_location_s3.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 319e0e2b4d8..37723572fbc 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -91,10 +91,10 @@ func resourceAwsDataSyncLocationS3Create(d *schema.ResourceData, meta interface{ tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) input := &datasync.CreateLocationS3Input{ - S3BucketArn: aws.String(d.Get("s3_bucket_arn").(string)), - S3Config: expandDataSyncS3Config(d.Get("s3_config").([]interface{})), - Subdirectory: aws.String(d.Get("subdirectory").(string)), - Tags: tags.IgnoreAws().DatasyncTags(), + S3BucketArn: aws.String(d.Get("s3_bucket_arn").(string)), + S3Config: expandDataSyncS3Config(d.Get("s3_config").([]interface{})), + Subdirectory: aws.String(d.Get("subdirectory").(string)), + Tags: tags.IgnoreAws().DatasyncTags(), } if v, ok := d.GetOk("s3_storage_class"); ok { From d541d46c6f8bacead1fb40b79643f2ec899768f9 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 4 May 2021 11:42:52 -0400 Subject: [PATCH 16/17] Update website/docs/r/datasync_location_s3.html.markdown --- website/docs/r/datasync_location_s3.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/datasync_location_s3.html.markdown b/website/docs/r/datasync_location_s3.html.markdown index 76dba7f56f4..7c20aef3921 100644 --- a/website/docs/r/datasync_location_s3.html.markdown +++ b/website/docs/r/datasync_location_s3.html.markdown @@ -29,7 +29,7 @@ The following arguments are supported: * `s3_bucket_arn` - (Required) Amazon Resource Name (ARN) of the S3 Bucket. * `s3_config` - (Required) Configuration block containing information for connecting to S3. -* `s3_storage_class` - (Optional) Configuration block containing information about S3 storage class.[valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) +* `s3_storage_class` - (Optional) The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes) * `subdirectory` - (Required) Prefix to perform actions as source or destination. * `tags` - (Optional) Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From 3bdf01150ea872c9d8dff776dc689c5f18d8ee12 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 4 May 2021 11:46:25 -0400 Subject: [PATCH 17/17] Add CHANGELOG entry. --- .changelog/19190.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/19190.txt diff --git a/.changelog/19190.txt b/.changelog/19190.txt new file mode 100644 index 00000000000..19c851f96a6 --- /dev/null +++ b/.changelog/19190.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_datasync_location_s3: Add `s3_storage_class` argument +``` \ No newline at end of file