From 568483c2a85a72e4f740b910141dcd0f2a5cf4bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0001/1541] 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 0002/1541] 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 0003/1541] 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 0004/1541] 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 0005/1541] 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 0006/1541] 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 0007/1541] 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 0008/1541] 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 4a0d439eb123986b1e11f28760fb7946494c5cbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0009/1541] 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 6de2c69520d45caf911ac0ad04bfb57228779f98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0010/1541] 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 4b02fb8770a71d593702e1edd0ae2fd4a88fb955 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0011/1541] 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 2cec2e19503bafd46a4b281f3d3711365751b1cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0012/1541] 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 00dfa0f3b9f29e4e004c4d1fa1ccebd20aa6c79a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0013/1541] 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 8d235f493cadac7d0314adb021bcd8fa268f8b8f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0014/1541] 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 91e1233778aee461d02d02d94e915f7db12dc065 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0015/1541] 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 bdc81526b567af5e20a758572a5c0cb1750b7c08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0016/1541] 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 05b240f4971fa924d677adcec1a26804dee5dc90 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0017/1541] 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 03029dfaded01a3648f22756af5faad80009337e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0018/1541] 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 d0e44c26ec573aa18e4a3a77111e93c3b14884b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0019/1541] 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 38111b28db53016972f4ce0b2733fc26503eb2ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0020/1541] 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 8a438a587f98b4caea33f32fd1fe2bea1ac96f8c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0021/1541] 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 514ec73338c25dd0e526c7bd24f392f864093622 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0022/1541] 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 3a1bb6e1317e903669901f35ce8ed67340fc1f69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0023/1541] 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 37a7e378b4835bca8d4912f8c05882089060f0d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0024/1541] 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 f50d10eb82ec2cd178dc4a40baee5c69330ac11e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0025/1541] 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 2d998a6ad1363848ae8da62bc47066669c3da226 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0026/1541] 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 f3142cb8d44836ea36db9a91dc24eb1ada035352 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0027/1541] 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 8c765d82918ce332485db40d3b58653952790f6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0028/1541] 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 bb2cc6c1f9c4494b6b752c141afc7351168693e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0029/1541] 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 7075f84313c436930ba65406f1055ce2f8723479 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0030/1541] 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 94bf75b5fe9e2fb67dfe46c2a70feffe94ebb78d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0031/1541] 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 00f5a58a8f8a79ddcde255e84bcffdda28dca641 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0032/1541] 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 5417d9c4890327f7db7d48358d605a4888c1318c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0033/1541] 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 e784c3b40048b87922ffb916225993f3d30dfc50 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0034/1541] 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 5b72f621b88b2f248ef48d0e1dbde695a80facd9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0035/1541] 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 be2dae42e3970d8f8e25ec96a41028c923ca51a8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0036/1541] 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 fb49eab2a5014b11968ab2bb4c45d6ce6414ac65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0037/1541] 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 0c9c79a1513d32f76ce1abb60d63b23d5e61858c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0038/1541] 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 5eee7750b07b4159c9d6e1a832edeac0b67d9ab1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0039/1541] 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 330efeccbec5f186d3dc5dfa1a0fd862756f40cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0040/1541] 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 675d548ac0d2be56700fdec81caeb40d72612f5f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0041/1541] 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 70780c29c89508dfe4c6acba95831cfc5cdab905 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0042/1541] 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 1b1da85a3c890df3dfba7c4516e8ef3e14b6f236 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0043/1541] 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 ba6b5e045fd32fba5171a05508ead59452639bcc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0044/1541] 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 604dfee4cb4f3f1f5f160cfbf42e278127cf8620 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0045/1541] 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 103ac1699d8fe79ae73d9a44d11322978c0e1a33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0046/1541] 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 47c55340cd20518d6a492b3602f6ed1d7bb1d644 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0047/1541] 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 710a1e18e5476e9edbc2d4a363d3a3817235a3b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0048/1541] 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 25ad2900ec18e0f36309661d70f36ee38247a2d5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0049/1541] 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 abea1ec23e7a374a42fd97841313bc4c78b3e445 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0050/1541] 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 e62a9266507cfb8eb2171da69b30c77f21e9e495 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0051/1541] 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 fb77f7e99edcc5ef68c9e53484ccc3a0f58721f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0052/1541] 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 6c24ed90ecd2f7ef432bf87c9351d681ed14ecea Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0053/1541] 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 a8109ad96ba3dfe6fdd9accbf46d138ca2572d6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0054/1541] 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 f130f7486579a17c9c3d4ed70b99b01c8c0c7eb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0055/1541] 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 e27dc7c93ffd066c9b046414ad8a31b3a44f2bbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0056/1541] 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 718cfb9a74ef66c0ca2a2dc0afcba50bc45532de Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0057/1541] 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 7680fb4ee35d174cbd2ae2b9c0bc57699c228f65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0058/1541] 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 c427fd671fdcee9aec833fc79de2f66eb100663a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0059/1541] 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 c4cee221f501692fad49e09d3a4a9060ce1c74ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0060/1541] 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 d5b61ff0630a72ca6552f5a9626a59b8ea4f7104 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0061/1541] 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 f4cba16170f0b7898c682893ba16fdac2f4081fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0062/1541] 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 9cbf79242dfd59bb09e2dabf5499070d3cec9ebb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0063/1541] 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 e3de6361cfc6b0273a6fef1dc4773c6944d82d51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0064/1541] 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 3e55b93725c4aa54cb38fabf13cbcabcd67951d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0065/1541] 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 949263cbe05d45724dc05297309532db9762d868 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0066/1541] 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 da27901561f07bb2dcaf337f2dbe6298769bf081 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0067/1541] 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 b0001c1918f72f40599ce9db4f9d39da7d4ee9c3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0068/1541] 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 17720db5e8a2e688fe6b8ffa374b291cb811cbf8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0069/1541] 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 8338f0150f103c353663b152a8749a8d89d5007f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0070/1541] 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 0bb94658650921b732ddfcd9dd2972cfe875b042 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0071/1541] 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 89162b3ddfa751d867412f4cb2d5d707e4b13459 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0072/1541] 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 47800b9d533d172627ba8b410a43bcd84b944a85 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0073/1541] 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 419bef83eba81b244f9899752d275c4ece94617e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0074/1541] 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 e4c474df935ce2a118b784854287f4220ef5a377 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0075/1541] 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 7c79b3bfdc17c2e9ce7d4812ab34a18af26887c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0076/1541] 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 ca140808934e5fd217376871aec59aa0da52e8b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0077/1541] 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 40e3fb9a35a7657cf5031f863df1874345fa71b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0078/1541] 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 7d6c499121d402811b5f7b7734428c141305792d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0079/1541] 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 ff5d36fb5cc9e24f5018c55f4e6997003a7335fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0080/1541] 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 8201dff6df5f7cd6fc60893187c213c13f4c057e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0081/1541] 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 1dc05d52a040c47d89bfa8a3a5d0170190d76d99 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0082/1541] 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 251522c61764f6dbe76d2fdf0873d858b92c2488 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0083/1541] 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 1a9362ea1c891ecf7a9209a28382a98d3ea82b33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0084/1541] 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 ffa817db256e47cc2bd8108df85df7108f375794 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0085/1541] 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 29a93d9800bfd59120f96d0ad63f6d078f3d550a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0086/1541] 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 9f4ebbc3d47dbf2f3c60969fa9a2911c427626f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0087/1541] 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 063a82afb1f9df95d7310110a2e76608ff357460 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0088/1541] 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 e39aff0958de9b2e7e449eecc3745c69b229fbd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0089/1541] 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 bed33fb085119f4f93eb53b19aa2831f39c5a8fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0090/1541] 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 4900a69c332cdb90f53700afd0acf21c0bc0dc9f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0091/1541] 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 33cc32a76074d03ece014303f6aeaf9f967dd2c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0092/1541] 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 5dc41d9b79ab6079a75e4415d9c7d239c59f5816 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0093/1541] 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 feb3ae7988d4b7c6b7020369bfde5252a4fd7a90 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0094/1541] 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 50554ffe539b967a14f79e255b43897a1a73f268 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0095/1541] 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 361eaf4bd395fa861cb7d348c6979f0a5f730c38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0096/1541] 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 ccccb4154ce18da111a78da4a88f27c53e7090e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0097/1541] 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 acd8dcbb8625b355d1e2e82995688029e787a4c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0098/1541] 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 ed43ababd173bb4d093676d10217a81370dc7bb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0099/1541] 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 c098798a165b3af73c4d82aa63a07dd35980dd3a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0100/1541] 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 88b57e05115969376dc4d81f098e63c772bbb9fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0101/1541] 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 906d61df722617ba19edcd0db447c15203d835ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0102/1541] 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 962d2831120c958fe9fc212a1c81301dc659e1a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0103/1541] 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 1ed10dc9f73f279a0c490195debb195142771dc3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0104/1541] 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 f8ca6c7ec566fda2ccf0ff1f562d49f29473758a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0105/1541] 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 2e82f83d59c10f8d8650c7377ba14dad5e3ebdae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0106/1541] 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 c5781688e5fc6fa542956032cc3c72d2231dd674 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0107/1541] 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 998f2100a47bdc41bf1e769b7a92cd354deda76b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0108/1541] 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 80025bf11bb8f48d1649718c3ba4f48922069576 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0109/1541] 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 061057b02d31a221f9b26f88d27a6aaaa0093933 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0110/1541] 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 8828d47729458793d1b1a61de50fac0736cacec2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0111/1541] 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 0c0b79b1b66d2c4e73fb3621b0fff84ec36120ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0112/1541] 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 1091c97b2251458624d20abcd577f5f71b00fdd3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0113/1541] 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 4bc39af2708824b4fedf3ca6132c18e50c6609cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0114/1541] 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 f16322206abd8d6c56da31c5c9295152b8af73cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0115/1541] 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 86a700f9f45e1683f24c4a7ea52b8e867a2de8ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0116/1541] 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 5d668cb5de4a4f1f4f19af4bdd9471ef00afc66a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0117/1541] 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 31d62a52fce6f736bed8dd5f444476897edb624d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0118/1541] 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 59b696cf211cda2e4a088b9cc73ee85acd63db3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0119/1541] 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 e22cb225f32d8636426f76f86c1b93311d419a38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0120/1541] 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 8c2d94450ff4f3729bd04ea9b49bea2fbf37e542 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0121/1541] 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 c7f23753b215854f3654bc4aa20fa6ac759e437c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0122/1541] 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 82893c238dab2e1f6eb2f127a0a1c2e341ed65df Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0123/1541] 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 c8057ae4bb4863e170f9e5b4908499b952bac8e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0124/1541] 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 c42858584e6999e3b2c039f1a10c5ec5847f1c5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0125/1541] 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 352f681619de059caf2ae7da40574288ee9263ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0126/1541] 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 c348c6e751f559392b7a39d5691b2a918ee4fb8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0127/1541] 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 4fd757a612a219a0fe2953ce9209170dd8561b53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0128/1541] 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 9090a5412bbc5577cff2bfef16c58cea8c8e09fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0129/1541] 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 47440db8ad986efab7f3c6367ea6d40c02925580 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0130/1541] 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 74df675575bf2606a0e2fcf9055891053eb0b71b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0131/1541] 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 02ec30dabacaefc8f874b8b19dc0ed54f7990026 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0132/1541] 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 702742907c3cfe764bef5953f03e03d909663655 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0133/1541] 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 4fde5e8f5b98016a08b1ca5a296a1d704f075704 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0134/1541] 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 e84288fab7f5068e3ef57139ba0701350dad96fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0135/1541] 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 ba0c0d4b69fa2b28a3040af042f81829ab48516e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0136/1541] 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 0b777c69f83ac3a0297f81ac7ddb53ca2e46ce4f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0137/1541] 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 519183956fb52fde356bec2400fa5e281287b374 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0138/1541] 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 992983a982e09d34426b9f6716cbfba69b5821f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0139/1541] 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 e4582209e792b0be8f7a2d31b53046825f42ce2d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0140/1541] 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 763aace324ca0fc576efc743914ba9d9213c8625 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0141/1541] 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 443b9f2f7dcf636b813c95a2e6a2cb62be70593a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0142/1541] 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 a4e317f66f693e34f41f62c7c847b9141ffd4f9b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0143/1541] 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 072fbade831366fc73236c4b671667c020c0d105 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0144/1541] 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 7a6b354fb97467f3d59f5c38b11a405ff965c4c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0145/1541] 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 1ea4228b40dafbd348619752d87fd2dfd64c3d84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0146/1541] 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 eb0f07aac131a7545443a9c833bb23fd4cca2e1e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0147/1541] 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 54f6bc95061e1c3f4c49f50605c60a841d584cf3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0148/1541] 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 d471b7b85f0709fb1bf023d7b9383d12e177cc0e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0149/1541] 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 00f999c7c13213296c5491b2b6252e5858fecbb6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0150/1541] 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 5cae0958c73584ad600a8746f78786b93530997a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0151/1541] 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 0313d57d1695eb92c396b817cd6e540a25521d26 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0152/1541] 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 a80ccecb724eaf7b504b158fb88a329b95a9ab1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0153/1541] 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 960e1ed3163ecae4467d8996860ca3f24ff76964 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0154/1541] 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 24168bfdc99d5ea34900468ec85496306d9b83e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0155/1541] 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 bbc08ea3efa1016c82142db1c18612aebaa42f13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0156/1541] 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 c84214cb325e8125bc670391c02363979210b1a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0157/1541] 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 40f9df53ef1eab64848e13d0bafd564932ca3b6b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0158/1541] 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 4313c0a96b94c1bb2277cdb21c327e19836cad0a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0159/1541] 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 c2e28e84b69af231ccf5fec4c8198175ab9f45a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0160/1541] 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 909890c60aac154b8b1767429fcbf3d0d69c4589 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0161/1541] 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 6f99f56c3d6ffae6cc5d38bb0113bf863abe0718 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0162/1541] 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 7f62ae01051f70bf519250a103d98b2748384f09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0163/1541] 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 2cdbc954fd9d1bd62ba7bbfccea3768674f5252b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0164/1541] 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 891e3bdfc26c14d228338295607f47edb038985b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0165/1541] 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 0c018825558ddeccfd45eda5f304d16b91ce5e18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0166/1541] 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 297bb2a1b216b8afa16db787bf5d09e75874ab52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0167/1541] 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 630c25ced5a0d4fc9c434265807016d38fb5bb10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0168/1541] 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 f3ed4f4ceba2072752fb85df9113103ad7af3b06 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0169/1541] 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 269ea04e734b9ab3172c324d43862cf7cdd84cab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0170/1541] 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 cadc1c77634b97229668391c61b02af89cb78869 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0171/1541] 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 d259a834cb48f1312afc98e83c04af6d5c986878 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0172/1541] 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 bd7b4f481cad58e3d6ec5774e987670e562b65f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0173/1541] 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 327184d34adbb5249816bf2f6b07134d648905f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0174/1541] 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 d140f6a1eadc13b017ab27e3044e9b1cd09bc39b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0175/1541] 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 54191aeafeb3a7d5da7a579894f1b49c270db4a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0176/1541] 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 4ab8b23c77097f52090d11c958765282b5a13ab2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0177/1541] 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 1944c51c0ff9366577af82268b7b0cc88dc8e42b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0178/1541] 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 9fccf33b9ea304d990f61f7f316517db44c0ecb5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0179/1541] 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 ea7da12ea65c432fbf135eabb56b68156bd1569a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0180/1541] 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 80467ef22ac195a31aca23ad869ffd65d9830d78 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0181/1541] 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 32c01dc6c79af939c478805ec42775c9f33b967b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0182/1541] 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 7e31998ccd60fda6d6a578ea97473d968ee92316 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0183/1541] 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 4dc0dc5c23fe1f11290452cc5a6b105ed859ee76 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0184/1541] 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 e4418c9f453fc21cedf8d246d4baf425d02f43ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0185/1541] 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 c3ba4b59c57daefaf400777719d7942d5d0f7f20 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0186/1541] 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 022c964ae69081df28a19c7a96afedb59a1306e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0187/1541] 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 b476a68d658013e034825348f00d91ac90997eca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0188/1541] 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 572046fe008e49983b879dc97cdd9d2107145578 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0189/1541] 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 81485656721564cb6612e354e179f981d7206790 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0190/1541] 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 118dd6aec4c712abb43b75e77790b5b679c62bee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0191/1541] 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 f98197e2a95c0df0e2ff78cfde64d30293a8b74e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0192/1541] 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 0754e77aa3e661a4971f96b8203e7c834ea6913e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0193/1541] 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 076d0c06aa706b04a98b385c64faca8e5252f5f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0194/1541] 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 2e5be8813a25db9ddb4b1355f399bfb2ce552117 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0195/1541] 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 13e584404d09e8fcbde1c91e393a3e7956ee7996 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0196/1541] 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 69f4adaa60b3f52464cdaa10cec5bc6e71171287 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0197/1541] 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 4e061375f0659fde9890d17300d2ee10f2664d47 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0198/1541] 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 89aa649dafb1bd64e08b9a05874348a5dcb757e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0199/1541] 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 70cf5cf414dc4fec78bb1f38f2fea15193935687 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0200/1541] 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 65218b07690ca4d43f22858f308ce8a6e6831203 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0201/1541] 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 597fab1ae9fffe2119a103be90e1aab0ff16e474 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0202/1541] 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 9a5fd043b539161270c241d4f1a4967fc3beb17b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0203/1541] 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 44de4296d29ad18486d0d707fadd77f4118f13a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0204/1541] 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 af656d62955aab98efc7e9117baeaedba87b97ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0205/1541] 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 6c39b10ae6b2df8e233899058a09e7891872b52a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0206/1541] 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 37dbd95022faea267ee3a321d4cbac0bbdeace31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0207/1541] 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 2b692ee29660c4ec7f3aa6fd430ffc0ca1f03deb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0208/1541] 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 9d9d82b2d9ea112140860ede8a766167f339cd82 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0209/1541] 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 338d64f75b8547184be1ae71ae75885f16916d54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0210/1541] 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 3f605ed751efcca80e136181067b4a47c4b34a67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0211/1541] 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 7dce210448afd580b3120062dae0bc235b0d1968 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0212/1541] 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 d8b34327855684ebdfe999e69d16676e16c766f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0213/1541] 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 a079b7b3a380b3676929ff1f39623d01ae61cff1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0214/1541] 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 e84a733b6d8bc80cc2f32fae218e9df58b633575 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0215/1541] 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 240905558a900d8b2e838e4c451b2acfcb39a8bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0216/1541] 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 966617c229d3370eb32fce6359df8c02baf07bbb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0217/1541] 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 aaf8787ba847c291660c8c549b753c287038d27d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0218/1541] 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 7f997ee4fe3ca2b9a72a86b424bf3d2feabd872d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0219/1541] 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 18f320b545b4cb6afdba23e8c04eb51a07339a84 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0220/1541] 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 8d53915abf8c3b493b9f9491c2b9a34ab70d2d44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0221/1541] 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 5b6f7c7a4e996f5bf9eba831b6e53ee944e20d70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0222/1541] 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 2b94dbcf290e1a00d4a0f3a28efbf3082d228c4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0223/1541] 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 cebba1ad5a6ee0839a2336916752cf460f8d6166 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0224/1541] 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 d0300ebffef5de08c275ec949f9277a7137bae8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0225/1541] 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 53ffaaf5f84e0f429204459c1d1d2b4a80b27bda Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0226/1541] 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 c4db33fd5c2eb469b5d2001a580cf1da5ac3cf54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0227/1541] 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 34479a11d3eb050d5f650a7366f789368d349fb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0228/1541] 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 976d958ad65875683e167c46755482c422840473 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0229/1541] 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 0571e27fdd1ff8e8f2317f28707fe8ddc4359473 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0230/1541] 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 ce0e131d190ef5cb8bf60d246093c05455a9a029 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0231/1541] 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 2875fc726ef524427dcf4702e5be4b37f9ff2062 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0232/1541] 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 4c43e1ad5f46b84fc484207b3015d8d841362eef Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0233/1541] 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 54822f6f01525e751888dfd0861ca0f68cb193f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0234/1541] 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 1c7be213234f173bf94635f8b100e73713230404 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0235/1541] 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 5fdfbafb4c87e8dfebb645269cd417d1bc4fb7d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0236/1541] 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 8a6b2301b517d121cd960b563b3c45e325a8b455 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0237/1541] 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 f410e274a5eeaba5aab7493d8c1879e0f06ee757 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0238/1541] 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 54b2c80c1e79281e712a0b11354ede2b313dd8a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0239/1541] 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 78b2ca39684b553a6d395adf864bedf2b9bb5db9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0240/1541] 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 ab7cb9b41122853a59854768693583305f599967 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0241/1541] 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 2f8c7aa1f1eec624dc08572b280f3ef1b8bb3562 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0242/1541] 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 395be2431e21456d31ea1698cc0733d009c22769 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0243/1541] 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 75475c4bd3f8bde3dfaaba1c701e71d5385499cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0244/1541] 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 4eb17cb1bf6241f6d17c74624b61490c171cd047 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0245/1541] 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 1165a862f0f7de69b5c1eb828b6194d30508c2c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0246/1541] 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 b0109e52b6ec51a5777a3f02b4842d72e2d7f2c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0247/1541] 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 29ce14879a3c9b5ee97684c862a59a833f540be0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0248/1541] 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 43cc9262bbc27158356a548d46951c61aa1b99f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0249/1541] 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 a1deef4e7e178fda5e7af0964b79a953b44d2197 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0250/1541] 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 6180a44b4ebdfa71a3f13555451fd2db10c9c6cd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0251/1541] 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 8fadd6f1470fbf10cad416640dceeff4e667899d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0252/1541] 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 cd9c9e0a3958dbf8ba50cf15c4bc390c5d16d3e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0253/1541] 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 4826261248ad624c09f0d3717d93ae963d08bc6a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0254/1541] 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 123ff076f182f19ba88d4ffdd5e6191263e4ac21 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0255/1541] 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 e070ef71c55a22626b989085cd8b3e6d1fd31f41 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0256/1541] 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 f4e1d5af9e3b2c2a4c9d73ac32121417b9e3c5c1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0257/1541] 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 24a12acc2aa6d843b465d27ecfd23c96b68380d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0258/1541] 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 f0e23cb0a705bf0497709b55ad19dd96ab4ed359 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0259/1541] 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 58aaafa6d6e683c2ebedc889b0cae1ec617f0c2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0260/1541] 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 6ba3ee19ef57fb9886157645cd50882a97df4ab2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0261/1541] 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 4c98cc6637febec3f153aa075149730dd12ee4b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0262/1541] 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 25ed4551c5f2e530d9742110098ac789d7e973f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0263/1541] 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 4b121d321d16427bf66afedc8e69ac35669b1be2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0264/1541] 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 31cbf97927f6c745c723199b3d07d9220b1066ae Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0265/1541] 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 b6b44e1656a96e86a831c29ba69f6c1c311759d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0266/1541] 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 1689e2dacc4e539f586d3ff5b809a63ca97ad930 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0267/1541] 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 317c557c40f7f37297c276417bb34a91d7c3ec2b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0268/1541] 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 7df5d3eb9d3a80aea771df7684bd1fb7743831a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0269/1541] 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 ef01462265a0f6bf7e974a987314d513d5082db9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0270/1541] 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 d5d1ac87e25ffd82fde3ed23ea32abb19fb0537a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0271/1541] 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 b9dfecf4b541fb2633ee9002afe7d41ed2c6aaa6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0272/1541] 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 784f43a029cbdaa0e1b57ce5a6e5e80b1a02662f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0273/1541] 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 dd50c78e105791fde43b39fbdaf1ba506f830cdd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0274/1541] 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 087615e0fa605cb117e1fbffb77496622178fb0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0275/1541] 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 a4365d8d052b92fe48585ab7a47f4f5c3a971327 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0276/1541] 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 22030ec60f8c1055b26f44f557f5975f100cd3d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0277/1541] 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 31e619252b348a01efc8134295da05f2e6a990e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0278/1541] 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 fa419f061ac451dec51c8d7d11840d6820eb1f56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0279/1541] 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 6ec721ff120192e41f6e69bb1c23c858239392e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0280/1541] 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 d060ae450e1fdb3cd6cbf9f43ab7076b0f215e4e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0281/1541] 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 b9ff2a76c05d923794d88a60effb0904cb7029f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0282/1541] 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 170b066c46017b6bbd8834113b93c211f2f7e81a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0283/1541] 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 d816238612e30cd2ccb92b60a41f00909711a72b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0284/1541] 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 cbc334a9dfbcfb619be5d0c72cdc699d7530d6f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0285/1541] 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 936cfa755c7d721baf8c28c7403b28dacb99ee01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0286/1541] 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 df70c1729feedca69fbe55ae30af77e90cf6395a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0287/1541] 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 ad84a271dcf4bbd6a04280735604abb021b9133e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0288/1541] 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 dc7dbebc3db694247c45459cded8b10e4db550c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0289/1541] 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 7974c7295e8f6786c4dcec08b6bea0403defd71f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0290/1541] 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 198ffcb32f1c8bbed8f0d92c72396355134a644f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0291/1541] 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 5a46ed6296b4767436e12f867d1f77f18a8c834f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0292/1541] 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 25f24d7fa8d13546ebedec206ffce008c49999a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0293/1541] 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 6698183fd26ed0ba601ad7a64590ebef2ae12945 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0294/1541] 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 ec430efc2052ecf32e7b51259ab72bf131082b36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0295/1541] 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 e5149620d8ca40688c32851a30b5dc244be29e69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0296/1541] 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 c4ce0f70a61ce3a36f9227a72a80aef2cd5cf9b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0297/1541] 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 c6817d682802449a0f9bab8a57086a3c9d842e4f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0298/1541] 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 1d99c06b84caef6d116967866a0c0e738df43feb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0299/1541] 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 c543e7a3531fbd5874c28a641dfff2ddedaccd34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0300/1541] 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 5911ad9ce02463f23dab2c2790f9353dff2126b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0301/1541] 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 79e2b1ae856e10cd4c1e1806d3ff42f6ad565748 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0302/1541] 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 a682e0e5bb2d1a782ee66487957c7a17ab3efc94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0303/1541] 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 a31b46c02e2736d6d357d1c072721a2ae7be0e0d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0304/1541] 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 d07f626a43751471577739e8eb8774178534065d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0305/1541] 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 fa9a11c9ec616c120a4447ccae23cdfb81631110 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0306/1541] 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 0234900633a2bbfd6b1a738b474d3aa235a5f030 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0307/1541] 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 2fe0af7d588d31e3637496b8c2c8eefcaaba6b35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0308/1541] 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 86054f2ef254d1a4e06a7e6cf2de89bdf90e4076 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0309/1541] 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 c67feacb7bc68a2f74098e89297aa13421742863 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0310/1541] 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 b0d8656f798a57722f5785689b6264efe34b5edc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0311/1541] 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 8004e27821c01e7b142affdc35984c2ab1033954 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0312/1541] 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 8969eee88f0d47bd7c52a66c71d53bdb42d8524b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0313/1541] 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 ed81143ae07191e81b5c5bfa7dd5c3f7a572310c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0314/1541] 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 ada160814b37af14750b5578f522cab41ae38d1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0315/1541] 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 da7c36cba371ecee0c19bd270f8091dd7fdb85b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0316/1541] 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 eee5d59fbd1b733f351dfe264c22cf6c71b49539 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0317/1541] 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 613717afa05f88cf8b314cbd89c4df1599d05f31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0318/1541] 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 53715dc53344cda6ad251153ed44258029521fb5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0319/1541] 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 d2741ff5a38f1293f8f7764fe82f4a375a2102af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0320/1541] 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 44eb72cebbd33ecb85d9120e282af6daff20421c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0321/1541] 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 63e4278e39dd7e648c5920b838b55a3ceab19e94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0322/1541] 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 101a316c5bef7314c4f11578d00a994de85815c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0323/1541] 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 baa41d3b7e50b96e213e28cc608798b87ab90590 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0324/1541] 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 46d14a2416b8243d2aa73ae79a06c2979361fd4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0325/1541] 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 28c0394f012980af5369cb0ef5b09c569c65e7d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0326/1541] 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 45120e4440038daaeaa11aa0eeb0ff9233df84ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0327/1541] 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 1fba543844a8da6cb159e875d8f48bebf6d454d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0328/1541] 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 23d912071e3e0a7f813072864e4bf5d4a0e68bb3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0329/1541] 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 7585ada29aad75e8dfa2ce74f190b8d4a687c14f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0330/1541] 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 2726053951c7bd096637d519584117076a51430c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0331/1541] 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 21c73d231a1d5e8ef1ae199871b7cbe5a9c2f89b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0332/1541] 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 cd41bef2f2ea26aa6ef9075e003213d3929158b0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0333/1541] 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 cd4b6a2cbd24ac9017198f5c0501d05c8b45829f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0334/1541] 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 f5de9db06b95e682454421ec2dbe5763fd4266b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0335/1541] 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 bc25177e34699abd1fd975c6663b561aa476527f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0336/1541] 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 c90ce42ce8f84a5dbcb624e61e80768599d2ab4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0337/1541] 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 c327ba35a4be1e9d5c65161883d479757d9c9d45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0338/1541] 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 222883ae71960960655769d8d1c469198f37bf52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0339/1541] 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 d7824f3d57bbe29bdbfad56dfd070ac9a5b997ea Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0340/1541] 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 6be3e10acd074fa56a5b1ce4fa69cd564dc27d57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0341/1541] 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 5b6a5b53aeade697e73804a859d7f947efb96819 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0342/1541] 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 463169119487d7d8e531da3fcb250d75acbba2cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0343/1541] 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 84ccbf1926197c702eb121e11c0351846b685a86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0344/1541] 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 8c919ff5e229c63f4073e4a4918f151c39b3ec98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0345/1541] 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 3c09ff56a51341a9cb34977e30070575e2609f8c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0346/1541] 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 d26166438c9ef4fb16349805c394747700283063 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0347/1541] 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 d80d5fd0c1a9829ffe1c60c89e3806eb5d09f6b6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0348/1541] 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 6afba093be3ead9d831055fd3cc59b04d5ce0ffa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0349/1541] 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 75858bd9383482ae233c293131317fa0dd3c4b38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0350/1541] 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 a0431d3c6db0513d559adc218a391fef03f66a34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0351/1541] 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 df358d5e8110c342b774de9d31470bb7b6a5f4f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0352/1541] 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 896ecadf50573a54ac1ab0c93921b329ba7f2530 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0353/1541] 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 7a2d03b6ceec4c668c2c3bc193c1d7dba5bca07f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0354/1541] 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 f8fcba9e9809b302a2cc64d3d064d9a1c7e2395f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0355/1541] 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 f27ddfe4a12f7c895c6824fd0a1e30c4aeacbea5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0356/1541] 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 34d1251098b6c0b1b64f0004b62afa7dd5944e2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0357/1541] 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 478542db0257796b409bb2602291a4234ecda63b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0358/1541] 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 cb5b35fc2c12f698125a31d7ca4aadca1f0d5d44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0359/1541] 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 2d575b405b7ef3711c5a4ec9e14095dffd99c13f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0360/1541] 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 6d13c15e985615f974d7cfc3ed208ad989ff75c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0361/1541] 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 b9195101f9d8f047eaefd18652be46310d048e20 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0362/1541] 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 d8c69781d3bef13ac2faff49061c9410cdd66ce7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0363/1541] 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 8da65ce6935812f09afaf826214b504ad53ba09b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0364/1541] 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 40e42742d6da204300042a035457bab28c486b87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0365/1541] 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 c3255cb5fbf05b53ab7a338a39a04fa7e8f7f120 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0366/1541] 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 4920a39e6c93e77825902f2f1f40f25272399ac6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0367/1541] 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 fda9c07264bebd1ef6746f0495af356a3b1d6665 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0368/1541] 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 cab34ad0a11bec9e635b90e054849b89f27b15b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0369/1541] 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 3d873524357812c3594ee62ea6dcbb931030a922 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0370/1541] 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 b0ad8060d3d28b9e783b393ac10371c3bd345453 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0371/1541] 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 f0c6a9388e05d4842c817ff05bda052273f0ef74 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0372/1541] 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 e330ddc09b26d43d0cc3ab9dc7c9d2ec2a0ced61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0373/1541] 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 d55d18b8dd4271d30e32d6b88271d96ee6325431 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0374/1541] 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 9c57fcd8d26b6150e77db5b49331e828b48753e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0375/1541] 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 f202fa24156a250346b29d9a48a0244e56e99279 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0376/1541] 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 4723c23e251b5f1a37f186195f48e2a61c5cbf63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0377/1541] 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 3aae2a9cae33e7baffb36d84f74a076571b6842e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0378/1541] 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 48dde9cc2a4a332005126871a0f0e890d04570e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0379/1541] 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 6f04c361970c3195b09f5b06b9e1fa793d8f6de2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0380/1541] 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 b78e5a0d5c7eb1685e8b99cb91b84e7c06d130e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0381/1541] 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 ee05f780bdc1226710734a9348ad688a36c26566 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0382/1541] 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 35b11ffb2c3f50cef0626f6d32a73e9958c8ac3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0383/1541] 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 d96b39ab5eb1ccc74e7151567e562d84edf68f81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0384/1541] 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 c3db857f27936b50d0a96973ec3c0b22a391863d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0385/1541] 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 5ad1336cf5cdb7373b2d10ebd6a7554b350cc90f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0386/1541] 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 48066cfb2c07ff2a856654504bbc33aaae6dcacb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0387/1541] 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 b9fbe64b1732fec1090227f0122febc1d6280913 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0388/1541] 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 8a56c9d72fc5b18dcd86a4be4f452bc27e209573 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0389/1541] 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 ed4f1e149513f0126e5e7163a0d4ff11a3cdd13b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0390/1541] 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 1744c7cdda39cad9eb215d13020cf6aa9f9fe715 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0391/1541] 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 0b16fbacd40cf60da743a4d1795bb51b31246cd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0392/1541] 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 ad99385d9bacd02518bbf5a9bd6626373b049acc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0393/1541] 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 244de3e0b7503c99bb804f731b764c156a697bd2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0394/1541] 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 adeed2991865c2b6fd59fba29a5eac1e9d8c4970 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0395/1541] 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 2a8057fa4ea54b692eee922c996f1e2dc0a99441 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0396/1541] 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 b39d40708961d654f61911b95a986455aba0e886 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0397/1541] 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 cac5fa824ad9b603ed1161ab48ee86e152794da8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0398/1541] 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 5cc5fb3f23fefce3478af95a2f9aeaa7aef8a69b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0399/1541] 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 210d21fce7020631edcfe14f98e444f560c8b6a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0400/1541] 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 5dd814792bfa41fb341e2a2e4b0e0cceb7216fe7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0401/1541] 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 f3125504f7ef1b1a2645c36c4dfb0acb38a233d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0402/1541] 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 d0c4039dd750b05e5a38ebc380a3ba4f8f0e8025 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0403/1541] 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 5d588401f6e8d68cbe3f1e42fb0d7e40c63f6147 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0404/1541] 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 cf46baae8d57f803e693129f4d7fd4bf6c28440f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0405/1541] 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 0aeb8820ec3be5258c2cc7b168d8682b385ea22a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0406/1541] 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 7216d0781ffdb4fcd4b2496b4e6edfc9b7b1c682 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0407/1541] 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 effc020486d43a71fa7dce01948e608d899bf5b6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0408/1541] 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 5143ad9bfa309d519f64698d913f7798e28fe895 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0409/1541] 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 d2eaf43f8f0291c222c62d4ccf2fc6f70cfd86f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0410/1541] 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 ad9e95a379fdba290f1fe0da56cc1487b1244908 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0411/1541] 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 619bbd71924d454a1eb1e3c26a5fb7637d2f7b53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0412/1541] 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 65229a081aacaa6c249366ade1635fb1d1023dbb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0413/1541] 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 357a4a8f6780f0be46374c6e14f9d53a2e31e52a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0414/1541] 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 3cddfd23b61a7ee3e887049db7d6c5ff2706e135 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0415/1541] 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 4cad1f8fcbd6289bddd7d320ca412fcb5be74152 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0416/1541] 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 3486a96bc9116aa1656cfb089ef9d127f5f3f168 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0417/1541] 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 fb795e35a7a5c7d8be7112422a988c71f93bd4a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0418/1541] 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 d589d3cf66fc6d80871b36b68e3ef61396e843f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0419/1541] 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 4c0a5b49bcceec793e7f61e0c347bfd7d781a180 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0420/1541] 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 1d461d9d21f2748482847d21a1fb97bed1fbb6d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0421/1541] 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 2aa8cc6e2c2022931f29ab1f33dbc32db60aaf15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0422/1541] 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 236d80ee0ab2a686c90d7d0c14db455ed0b4ef2d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0423/1541] 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 491a5f033309335a175da765f5a10744c79f8423 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0424/1541] 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 c56cab1c95fe0d8501ee72cffdf7ec198b62981f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0425/1541] 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 4ee2b988f799933e3cf815c1dc7c29718258b994 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0426/1541] 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 36ed5572168426b4f892b4781d07b5de93e9a0b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0427/1541] 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 dcfc611b83acd1b6e9193d54cc64ffc1c4b4ff63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0428/1541] 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 a4e09a6ff8e8c0e33aa1b9bdf39d6f96b83dc174 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0429/1541] 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 2456421d74374437801b1873ad2151070e2b4690 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0430/1541] 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 48cfe7f619b828b610eb3a7309ecd95a42c12156 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0431/1541] 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 bb955ba1e6207702a2f7f8562a71d6356aa4d707 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0432/1541] 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 c7dbf08c39f0d69bd4af7283ed66210ab2832a22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0433/1541] 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 6c054125cb2a27492fee601b653ba1d06387c046 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0434/1541] 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 5eef4d5a45760baec4a3e91eb76a82bd417e1412 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0435/1541] 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 402e8f07740d650dad3d36cd9e46a5187f4d371b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0436/1541] 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 b1e2b7120c2782723cbbcb6aced36b88ab0d3b83 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0437/1541] 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 9f508fd5df833f9cba5b213c75492423de860949 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0438/1541] 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 17f96da5d6b02d4cf6e816b1c781082b07642303 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0439/1541] 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 52d60c5c39bf608c22a02bef32acf3f58a150a4d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0440/1541] 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 e45561e14edebf4e8b1d81149cacf498ffc1d0df Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0441/1541] 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 f76f61e55c087511339c39984d68cb0d3b6e147f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0442/1541] 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 894cc2a96865dd2f422f15df4217b54b3a144ea4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0443/1541] 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 7a5d0f548e4919c99b1165b02535b7408f7f7e9b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0444/1541] 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 7f5609daeb8fecf5a7dce78bdd3445f120763817 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0445/1541] 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 cb20332de477496c2d74a9502cf6b3e0ab970c11 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0446/1541] 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 90f75f250dbdb0fb28b5e00a7c873eb00a62cc88 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0447/1541] 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 75d428705ba29d59e2d81ac0b52e09490cca7fa1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0448/1541] 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 36107d80b6855fde2ab2d6a8536111a68986f139 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0449/1541] 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 63ef65fa0c351e3a4e6a59eee5f22e62fa36ba4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0450/1541] 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 121295dd2d9410fc410551db1b78f97e05b7292b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0451/1541] 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 c81c766c38bd0c7e3bb9222876e22ae1ad5448d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0452/1541] 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 ccc700bfbc5ea7d41c5a7c35df658584361aa959 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0453/1541] 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 7c87542562d804ff365bde019b5f9957230faa51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0454/1541] 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 ff59f706cc990c19c503b4080fd82248ff68812f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0455/1541] 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 15f18b858436b24bd537e2ecc237497c1e7ed3d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0456/1541] 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 6c83abc1f0002ade479685ec269c22eb98c094ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0457/1541] 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 bcb16d9354f740157003430b8ecfb9df80f0e536 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0458/1541] 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 b33e874eb02c1098d39f9423031f2c2cb48767ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0459/1541] 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 20fbea394b0d16f42c628fdab17c517fb111dd47 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0460/1541] 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 e468ef188c6f3e1414377ef110b4ee58594a99c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0461/1541] 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 e918960494c7d3054020671dba3e770a06f8100f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0462/1541] 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 f61bdd116ddb3d1afdce3f76c8790780c47334a6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0463/1541] 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 a567501ec02456f7dfce8132744ac0dee0b82ecc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0464/1541] 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 37549a43aee4d05bcb5216cdffd365154df25b27 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0465/1541] 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 14ace48339c6061303e17782a61def0276acd3b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0466/1541] 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 13fbe647f3e41265279b111102cb1f2c7a31a7d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0467/1541] 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 6107e8fb15f9a014b3996308847116913a8b5d62 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0468/1541] 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 21fd969a6fc419c5bf1ecfe0d63b3651da030b57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0469/1541] 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 90fd5b4e9a955d26c4b91b010b896cd78bb6e111 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0470/1541] 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 a4837d02d93ba47a1f044d0858de32d9d050a3ca Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0471/1541] 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 3b1a92fd67463642dfa04e88a735a9440594510c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0472/1541] 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 2153df57e0839c97b0a949a0b1017a99380dbf8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0473/1541] 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 ad6696525f04cc638cfa78ae084733ddfefca026 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0474/1541] 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 3cc0142fb7023d2617d7b0c161bcad97c76ba3f4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0475/1541] 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 44909b89e09e4207894783d5fbbaec7cf28a56d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0476/1541] 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 39a640d702c54eb509103b0367cf386ca9d7a5f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0477/1541] 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 44b2c5a1111c79e58fa701dc228e0b363140b4bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0478/1541] 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 7c39642f472e3c3efac57d82155d6f96fd6e471c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0479/1541] 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 85de289b372e143b888d507415b61516534e403c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0480/1541] 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 3c6ebbeafbc5fc5675a405ac0ccabaf3bf1e1776 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0481/1541] 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 96e6ecaa9883b3eb6110ad9ca821d0e94c0ebb61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0482/1541] 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 b596e8d82f88e5895f962a304c35409449c5ef24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0483/1541] 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 7823dd2e19266aa821647b04da5c19776ca4854a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0484/1541] 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 73ebda2c354c1c87e62e52e7dd7d9a8f52e98a9d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0485/1541] 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 6d81d146faf691f3f57ebf8ca3155a33a5657ff2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0486/1541] 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 d31a4511c8359dcc40d2c6745d7da78c979d9ed9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0487/1541] 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 f3f942a32628b17ba2b0ece076d6ba0e29bb3af9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0488/1541] 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 3cdfceaacc0761035ca20ae7ad8457d121385f5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0489/1541] 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 c44c7b3898d9b3d517ef35ba98c87a30a868695a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0490/1541] 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 636e274553581b788fab50ba0108152189831e56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0491/1541] 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 95f5711af107634a3d254ac560df763a537df90c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0492/1541] 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 5784f77b26477775e1f89f634548760134768481 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0493/1541] 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 c74cf69aa10b90f5da33da167f4fbb4362f18bbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0494/1541] 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 86924dc5954d72e4d7e534e36d4cbe1284ca0f9b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0495/1541] 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 4bfa34d615351aa7375d3993e24f9907df99e580 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0496/1541] 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 269459d366eccd2728374e66a4e7c9eafce21fad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0497/1541] 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 82dd97eb63371e132a14b75841e7c223da834523 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0498/1541] 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 9522c4d3a4c7b375c0ccedec7744bd735693e41b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0499/1541] 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 4a32f6796d5eeecb6192276b503aba492093f604 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0500/1541] 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 b643a4aec0e93da97dcf19402c42cec8e67d6f83 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0501/1541] 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 f753998062b956d0790e182b9cbbb356ca5d2ba1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0502/1541] 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 2444717e5951aa91237df5a09f5f3aa748257bd8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0503/1541] 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 8a33d37a45045b8166b21db47063703b6c580c9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0504/1541] 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 1ac5376ab133773787ada81228aa262d19ddb3bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0505/1541] 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 ac11e199319fb34724cda92c950c05ecb8afba65 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0506/1541] 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 4a381f98f1b1aa60fc540ea168e874c89253d500 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0507/1541] 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 55529ed4a01435111da90a49951f3bbc8854dc38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0508/1541] 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 02d0db97d35658ab332c50a90989f48e4cf80538 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0509/1541] 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 503b6ef3a3012ee9f39ccd654097c820625b355d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0510/1541] 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 19aaad3d182ef406634601be63bbfac2f046c98a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0511/1541] 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 c98d7caa6e8bd28ed14b242f5e1842ad943c39a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0512/1541] 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 a760715c29ae32391e39210522bda66a8b20ffb2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0513/1541] 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 077ace772bb95733b67131cc445983e2d6cb0149 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0514/1541] 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 2ceef2aa9e606fa037d2b3e91afeabcb1debea97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0515/1541] 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 f5f466e19ac4054e31a591699f8b0030bb155677 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0516/1541] 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 077098cd8946701883564016c05193b922e7d952 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0517/1541] 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 1f183b32a07d9bf76a54a7aea850e65f605bb208 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0518/1541] 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 e06f078f6993cd9865697d00536887f5f90f40ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0519/1541] 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 8f093fce4266eb0d1ee55b5b4ca2c956f2f8697b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0520/1541] 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 575f691a8676e90ddf256bfb9dd6f8b8089a0b7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0521/1541] 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 c89d036b3fcfe07c1a179c9e271383fcdffc8b08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0522/1541] 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 5ab1d3525c02e4675d5c1d9e91d0def267e60d39 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0523/1541] 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 496756e158f7385d1d09f1619482a71aacc654d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0524/1541] 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 980681b576b5da7dfffad7c6c9a12153bb3bc4c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0525/1541] 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 b5cdb7a6cc09d33cf0cef17bee3e15d0eada5a76 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0526/1541] 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 300aeae04f6e8a7cafe86fc43015587087452a83 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0527/1541] 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 44406a78adc6ec0c613319a7a22ddf08069646f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0528/1541] 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 0f7e9c002cfef4e1d86727f25f3e87b218b76af0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0529/1541] 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 614013fcaa5c67be843c9d1f12927a427cc430af Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0530/1541] 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 399d32f0f0f77ed9bc4ca8adb4e4adb22b63f3de Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0531/1541] 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 29d13b04227afd96fae9cf452326217a6b51a23e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0532/1541] 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 eec708eb837cae847878bd0011532ecf4465f1e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0533/1541] 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 bfcefa33c88dc5c51213f74db0bc227a117178c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0534/1541] 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 6ffdc211425380d2e2a954d941c1adadb6b5a960 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0535/1541] 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 40f38ce86eea8b22835a1db442ee3fea77c6bb38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0536/1541] 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 7ee5bd3985968fd7c2f8c3cdde43dfca2f4e328e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0537/1541] 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 2cc99b515c73e9aa3b12a1cf0972488e4c5b8101 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0538/1541] 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 d51f9de8749b7d6b0a4b2f7a2b3b6877a5d9411e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0539/1541] 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 aa3cfed7e0a4a7cb16c48f33eb68c85589ccb9c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0540/1541] 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 03ab791795eb7625481954a5d48aa3a622250cb1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0541/1541] 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 7c74e1733087e5c27a35da296b219f2216bf2836 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0542/1541] 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 aaf508bffffefafcf23afebcab15e86dcb1e25d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0543/1541] 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 59f9a01f4973562e832936e2c0b7152c0dd1ad9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0544/1541] 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 bfb3bb493db29c6ed376c3babb7b98fee2893e43 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0545/1541] 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 864864a812f0cefe6c26cda291d344a6ffe6cfa0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0546/1541] 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 651b419b4beb335d30810e54477d21cc25042ba9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0547/1541] 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 eb4fdbcc39633b986076615e24170bf09b9ac718 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0548/1541] 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 0a5a9484c122247d8bfd58d862bc81d1f1f6a747 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0549/1541] 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 738ec42721c496861e813e22bf0cc830cda9bb0e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0550/1541] 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 fd559cc57b164a2486bdb759959f9af9aef073c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0551/1541] 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 4df0bf3e82d98390e39f365ceaa8a739aa534578 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0552/1541] 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 0b75e0e2707a5304115cfc881eb7322aafe27855 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0553/1541] 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 c3c608f84aed4f1c3ce62ead92715d0d2fe66c0f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0554/1541] 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 37ff4ae07dc3f56e5c74b750a5ebaab7f95bdbff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0555/1541] 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 657f0c3f6afd043b08dd28e73be50c218400c195 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0556/1541] 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 2d5c0baf5b91f74686e5d57f0dc059874f79b5bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0557/1541] 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 075fa590d347d474c999c569fdc0c0803df3ad4f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0558/1541] 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 7f2dda9adf967b5259a9e81dc06190bf35cd00e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0559/1541] 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 500535a725ffc39dd06cd7ad89b2c0d45616005e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0560/1541] 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 50d4abeb9622e556f6f37bd378ff193e3d64e132 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0561/1541] 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 042b40be429fe0fa090787336fc537f371efcd36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0562/1541] 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 a5ddf924a5dff1db011a0a63ce19951ecb7ce31b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0563/1541] 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 635cd4f407ba4f75a2f500c905b2d17503a6eedf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0564/1541] 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 ade3884ab3653c3d91c4b1785f4ff595752b45de Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0565/1541] 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 f59de89276f973366bd9932492324c730a5020a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0566/1541] 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 d6b043654d1390e0081b25509d16eadf782ce7d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0567/1541] 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 02c14305e1d963808a9fecc5e887a8113d1169fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0568/1541] 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 23eeb6fc563af31e4588392032e4018490768b4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0569/1541] 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 4d71e3ed353e81d064948131273858dea8a0e664 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0570/1541] 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 16cc5a760d7f095b81ddc90beaaf762528b1cd1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0571/1541] 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 a1079e257270e862d6c556d9a5c38bed40aa9fcd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0572/1541] 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 24a8ba56ac6ca62537cee4be7951a32617f5c69b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0573/1541] 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 f6d24890ccd52d67190723fd9a09ef48eb56143e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0574/1541] 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 11822131e4aa58152e656dbb9efe0e8a465882e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0575/1541] 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 ec8be2bee1de59f5f91e517fc2dd7595852d9be9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0576/1541] 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 57c27342968abf617634b5b79653c940f2115df5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0577/1541] 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 de74ea307c030f829a4f7738c2741b1599bb0877 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0578/1541] 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 a614b91059efa274129df283156c71b864aaa43f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0579/1541] 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 88d135cc1900b808c3c241f49902d30693f1194d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0580/1541] 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 c11d4418c4a1f4746c9ed1393b4f6dac5037a234 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0581/1541] 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 07864d22a33039b4a233ad1c379dfc9885049d5c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0582/1541] 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 90b8eba46b94b4aa420f18650c0e0715901dd222 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0583/1541] 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 aaf8e5e67df4c3d84ed3691fffefc1e0e5def57f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0584/1541] 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 c2d02353af7a5e4c5b31cd7d5e04151c430b2fc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0585/1541] 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 20ee0bf9fa2299f0593af389c0f911503651317a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0586/1541] 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 bdfab1110e1e2488f094cd9f48e3f4a183caf1b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0587/1541] 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 a3045b633fb882695136dbd20c63e2af4de73748 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0588/1541] 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 bfb4fdd934f6ef6c5faee5712b5f091f6a481ea0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0589/1541] 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 5069e4aae7aa271c2e7ec807d05387133c7e6845 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0590/1541] 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 860c04bd404ab47475f2a5a33eefad776ffea3fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0591/1541] 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 179762da8a14ace240b877c6c1a65e8effd2ff68 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0592/1541] 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 f3c2cc53cb843b86d098ac27bc7e7ec17aed12bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0593/1541] 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 1a64c5c438d718bdf299457749eb3cd31f3f48d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0594/1541] 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 80bc6dac3e882ddf8ff3ef85bcf47dbc9784a8cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0595/1541] 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 9225d18aaf074dab2d2f764a746e292d3fa09074 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0596/1541] 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 e1c9d58827e353051a7e35aee95aba74c8abebbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0597/1541] 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 377a51eaa679fdc6b33dea0bd0b25ef44129d2b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0598/1541] 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 656e21026678f967db179a3cd440abc5073bd641 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0599/1541] 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 9b0c000fa50779f099f28315133085fcdf97f98e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0600/1541] 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 062ea3a294cea2f88c03dc32bab4f8fb5a201b5c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0601/1541] 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 1389487a1de7f77ab78fbcec4296ceb9933feb5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0602/1541] 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 26c65e496cd4a885e801579ad104cefdcb71dba4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0603/1541] 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 91c3038e7757c41f24999edb1a7ab9fe92f00ffb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0604/1541] 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 3d74601bb9b48387ea4c7809ea9fd6f3cfadb895 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0605/1541] 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 60e27fb5b1245df27c713bbec4916df8ca3da9a5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0606/1541] 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 e77232afb788bfab5509ff40207a80e747ccd039 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0607/1541] 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 2237bb9c0edf206cab257cdaf22e47fa90e8624c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0608/1541] 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 4b0bbcf30804cd5ae85828a33a878398e45cd398 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0609/1541] 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 1272b315f13f8d1070ae3bd86841717c32109d9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0610/1541] 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 daf7f116ad23cc641c1cf36a764877322e25d661 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0611/1541] 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 92760f4c82175ba888de998698c904f03f202250 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0612/1541] 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 a0ce0ba56145f3a9380ea4b88bbdeb1366d8a662 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0613/1541] 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 800d85cff5d9b1d456152f00e23788828a18d067 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0614/1541] 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 99942671e92eb1899db4001b8ceec26a7fc47d0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0615/1541] 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 d9dfc276e132f24af7061ff28e8d54888651e509 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0616/1541] 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 cd4e0e2add2488a892404204b0048022ae1dc41a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0617/1541] 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 2d1920248cdfe71a0526e9dcdd5e51c954378404 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0618/1541] 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 f574019db9faed7887eb0ea5c55473594ae144dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0619/1541] 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 3e7c09e6d73bd69dd148bdd65e3a95cf8745961c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0620/1541] 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 b698814ccf1ad0d3aa58979591b6dabe2fbbd8d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0621/1541] 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 b97ce08dd5a9614da3c71e07529d655ea7d6bb81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0622/1541] 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 f8fe0fbad190a2a25bc852cbbc3d2a56b0ffdfd9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0623/1541] 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 ce607bc2ca787951968954dce61d267041ef5096 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0624/1541] 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 a961b063e23fac34d13b2ab2b0093b5343f47020 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0625/1541] 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 ab0b778a57f754a35d48cd057c064d7602a10561 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0626/1541] 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 c13a706dffc3ee492bd6ecb83e74db01ed786298 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0627/1541] 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 582865ef698e0c96d599d456758be13b725b6263 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0628/1541] 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 707be71a7e4d56feb5d9a2540b33534942f27da1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0629/1541] 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 35c09caded2478b501782d07caaf0f8648e2711e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0630/1541] 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 972c48786b00c66b7c08b2955aaf13d1202c850d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0631/1541] 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 f3efd0ca4bea0e8bc9947593b981e272354ecaf7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0632/1541] 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 6aa55fb01c4ede000683abdb1f0ab98c26bccc31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0633/1541] 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 d0f07be7de09119b4cad8900873aa1a5a9f5eaef Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0634/1541] 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 d6915d976b458d2d8cffbd1bc172004b3fedd529 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0635/1541] 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 e2be22f3aa919b7d2e87feec4a40870aa69fbb73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0636/1541] 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 bbc0a98efb0cd683a1461f0fc2f138e22a427ff4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0637/1541] 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 2f67b6a7b4d11d471c4e1b9488777b5fc3c4ce43 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0638/1541] 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 853acab1d23c2831db1aed253b00d9dfc22ae92a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0639/1541] 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 9644e130b7d0f0ad6ef12cb89c81a32a6ba72474 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0640/1541] 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 4e05f1a0a6f21d83cc38dd73982460e6d115843b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0641/1541] 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 9ba132db920d0e005de477e587f1d1edfe9f2fb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0642/1541] 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 cd607ca38fbb356cfa0376cf853d56ad734929f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0643/1541] 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 e434fa778282c59c956e5c1510c5d37088e5e042 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0644/1541] 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 3b69de736b2d813284f40251b9f81ba0918fecbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0645/1541] 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 720e007c8d63cf3e0dce3ca137f2e5f387db453d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0646/1541] 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 69836cc3468ab2abfe2c19908216961206f8c131 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0647/1541] 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 05eebf6e2220dde98dfc8273e898e4457ec17d18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0648/1541] 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 082c7ae88de0413899aea373a96d5b35d841c19f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0649/1541] 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 a290277b11c0e96091665b04451066cfd9c19a0f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0650/1541] 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 35a4d3940f913015054581622c5df5bb33a46583 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0651/1541] 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 40f471b0ad59059f1a4ba5fa15b162356febd865 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0652/1541] 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 009bcc005b70f342b42bb29aa45921954587e93e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0653/1541] 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 e64fce5b18d51d8574e17dcd9c4e207725f75c3a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0654/1541] 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 50508921cd26545b165657a7bf927e238e163752 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0655/1541] 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 46a50f77c304c38cb779c55c37f54b099bb80db2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0656/1541] 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 4add63e01f4699676037435073dab11407eb3c51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0657/1541] 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 f7d76719b87f3acc5c83ce9728c0c747422d9adf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0658/1541] 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 cfd62dd4ebd644169dcdc94329db4907d140bbed Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0659/1541] 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 141e2c59b8c84b29f60f5ba1072542b3cb9c028b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0660/1541] 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 3710239517606d36865afa2752801daa27d55203 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0661/1541] 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 8a3da52ae09f16af50fdb113577da3a067002cdb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0662/1541] 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 fd24593e3788359951f8fc16f88ddead73cb17d4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0663/1541] 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 a32615505ecbeaa1b4f55f02c2aff1859869e423 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0664/1541] 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 12c26bf97055fca97c9a4be7334a01b0110ca4f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0665/1541] 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 0b69756c7e120794e09910ffe38e44b059515f87 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0666/1541] 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 9c79ccb62a9029ffc4ee2c4a8307469b7bb3ea54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0667/1541] 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 5f375a0a53d7249900d3975c128aa6406eba9376 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0668/1541] 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 0b74475f6a4f2473d86de0324117bdeb9a089eb9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0669/1541] 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 1fc5cbd0f59c9947d63d30762759206a293629ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0670/1541] 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 187a4714ffdffa59a869df5ad554c59bc951f0c3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0671/1541] 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 9203978049da7922725ce74081d4fc4d2c532476 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0672/1541] 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 912ea92127a75de2d8e80c55ae46d82ec97257bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0673/1541] 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 ec4469198f93e204556a3f8be09b466bccee2cfc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0674/1541] 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 ce2073d33a0c011514950bc688cade5f59534386 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0675/1541] 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 58f132f20f0c3425fa189d11b47221e645b86519 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0676/1541] 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 3c5fb810cff3dcdfc2e9d89fd2d5dbc91c0e3a88 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0677/1541] 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 d1cbb49007c99de28a099da5b926f1217b2b594c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0678/1541] 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 b76766e25a51075131f151af071d744b2652e827 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0679/1541] 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 a034f2f6f8f888a88547770b291d410bf1a25794 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0680/1541] 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 86782638cac9dcc01ffdddef21a489a0325bc43b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0681/1541] 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 60269effd725b9f8e6defaefc9381430584a31d8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0682/1541] 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 efdfbaa70293617aa98ce45441ff20be78456c3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0683/1541] 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 fc3a20487c2f9bbfbbdc3c0c305899520122c652 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0684/1541] 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 7050e102faf86d13520b25bc017151aff24bf443 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0685/1541] 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 3a83d0896a5f65cc7ad2f1a4569eba5d52537061 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0686/1541] 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 7857a839f0f4ddd487c2cb9892909cebccce45bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0687/1541] 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 2709116bfc5da992bc75abd7c9303276fd65f667 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0688/1541] 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 83cc3a643c75f5864fcd2db7515fa14fec2c94f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0689/1541] 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 56b8e482c05f76eb30d2177a989f7f53036fdd86 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0690/1541] 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 51be07532ea0333565b575d5d601cd1335c4d41d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0691/1541] 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 249379bd3933f812cbedb08e18133c62a2f77b45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0692/1541] 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 20665b014ac3a9678b63f90aa561660cb472fb8a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0693/1541] 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 85af5eb3a7b9a34a55856bf187e77b8bc29b7125 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0694/1541] 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 fe6aa7de40a16ae694c8d70fddf90fb513fbdf44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0695/1541] 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 a04dc8d500b66d1f79daff656a70a4c994b98728 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0696/1541] 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 19a163680eaf94d02eb4fd56710392e950c5e0d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0697/1541] 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 a4241d5104f852b8b0f9c4efc061cb01472b56ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0698/1541] 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 028175c75c82d0f6a0f8b2b2be6c74cf97197fb4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0699/1541] 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 fcd38ca93607a39e59b20605e9dd90de78ce83fc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0700/1541] 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 46ea90c8d7f9d4a5e194c7b0592ad574f1a85006 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0701/1541] 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 e93331403c884f7b7bff455816f905a18912115e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0702/1541] 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 a014d9810df384f14b872e84d3bc6ed77c9d547d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0703/1541] 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 e552ab2febee203345b533e3b8428735b790c90e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0704/1541] 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 8ac5062c538a22df625dc3bb127ddbd5c89d947b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0705/1541] 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 8ea900bf6a2ea3e053302705f038ab9cdf98b279 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0706/1541] 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 7919a212296df991cba543c5c861d70e303f76af Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0707/1541] 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 26527ea1437e305ece6265bfbb7488e01ea7097a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0708/1541] 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 42751b20aebafdbfc2994321952ad8df828e2d08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0709/1541] 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 99c461bcc5760005fe6df85de633149c28f970dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0710/1541] 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 fe3dad35db1cca35d8c20b8e51b284a00631372a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0711/1541] 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 5f77d6221cde021fc22c987d31bd5d5426e338c6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0712/1541] 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 9d57778bc13a795a0f0aae55e461e31d51f7fd02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0713/1541] 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 afe6a2f4c5cfc1c322dc6e11a1092f73a873a68b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0714/1541] 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 1e82e165bc64557411a5e0c7973c17322982ca10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0715/1541] 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 d83e191f6a4ec45e03dc3537a8004f04ec548413 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0716/1541] 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 ec623f0962d437f7dc5e768469824c8099778040 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0717/1541] 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 e7b42572ded364b5ca70c9f2f26efbabc32fdf45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0718/1541] 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 2ffbf7f8a997433cd68289c54bd082a1143e53c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0719/1541] 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 83a59e5961f6c570069d5f32be4472055f042593 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0720/1541] 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 3a4ccc37d4e52904c972c7173ee545486cc98ff2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0721/1541] 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 f813d16435539e8ef4cd13dff7dd2c22b1001344 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0722/1541] 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 dc777056a68cf6b9892b194ea6899604ff485d81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0723/1541] 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 8f51dff0dea0bcbbaf54f050ece81075b794126c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0724/1541] 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 b2aa63640fa03fd11e80df6aceb0365519249c4b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0725/1541] 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 129a0a3eb1b3419bf2d7e64739b5f8944d4afcf7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0726/1541] 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 b23830a6da400fccceb05a08b0ed5fda5c604c09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0727/1541] 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 8e0ea5475ee4c6d6e2f3492fbd20534a1146bb98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0728/1541] 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 27f687a5eaad71d8983777e5772a3395ff96d653 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0729/1541] 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 d57f3bc3e7e2ec549af6209857d78565ea7f91e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0730/1541] 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 acbac344477b7ef015d2099afcf9a879a8dbc9c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0731/1541] 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 ca6dff5ead9d9a72757b0e0f7a0f030e4185eb71 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0732/1541] 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 4833989875ebeed07ff8b2d8bd6d20d7bcc053d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0733/1541] 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 5ad85c618cc0b75822cd843b7090889a9b33bbed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0734/1541] 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 d32057e3ee1f16debeee6185b3d62a0125e7b64d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0735/1541] 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 2df330bd1b721400b5977eb5989cd3f972ef3dae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0736/1541] 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 74458478e11a7b80a76787758059d16b663ebf49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0737/1541] 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 76c098d53bc8c4c60ccf5b5d0bb3c807185eeac7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0738/1541] 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 bb0abb97b787bc2fb019d11b40854a8c9f22afa2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0739/1541] 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 14b2d3f90daa384fbbc5610a1f8d23e64912e4e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0740/1541] 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 58aca075d48e8764a08432f5da419f4703fc1176 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0741/1541] 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 d672ad7d30a7f56f45b3563050dabd8c070f25ca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0742/1541] 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 94f50b797752cf0c2ced5b564c7c73abdd466e00 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0743/1541] 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 b035bc97eca00edb66be4d5522f16a1f1f310431 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0744/1541] 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 948228b16e15f9fca774c640e505848c84cd764d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0745/1541] 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 7c5a3b5c613184470ee722b1faba001f41f2e0f1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0746/1541] 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 87156646961f4005ab7f3e1cfaa3e7a44aa0fc46 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0747/1541] 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 eea67053b16c29288ab1ea351b1890986f14261c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0748/1541] 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 0a0da01996dff393d7400b6efafa3d600e347c1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0749/1541] 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 374a0ff9a9f0a987c3a3be912121a1b44d07dc9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0750/1541] 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 ccad08dc722a822a6d97d51a32f3d05e05b3269d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0751/1541] 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 9e4ce4b3538fe78636789a8cf1485ef4d10e0c34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0752/1541] 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 95a52fed1571f6dcbc55e2443fc1ca07e764eb0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0753/1541] 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 f5317c6b02607fdea22e78cbe5948e7275874ce7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0754/1541] 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 e8412ca8631fec5540c08b27330b203e26cee5ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0755/1541] 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 a5061e313d0148519073cdb57fba96a4228121cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0756/1541] 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 b83481e41af53c311c2f38cf8af5153df329c05c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0757/1541] 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 9a3c8d1564129b54b19ecf4946bc3bf5941ef7e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0758/1541] 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 de5413d4e775631328d66bf4987bda4cdc59de6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0759/1541] 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 00f656a147ce6c3350a141ef593f19658942e433 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0760/1541] 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 db264d04282ffc1986c6268e84fa0d5814ed23ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0761/1541] 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 0873ca01b891c5bdb6f514944add11b748438579 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0762/1541] 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 ecdc33fe11491a049e0914f5c1b77f2f6ffb9ef8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0763/1541] 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 c0006a0e22be5c04499884ad9aeab3eff6805fb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0764/1541] 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 adc2d303d1a33006b3f7096d2e8a2c61802be5a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0765/1541] 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 eb0234caad7de78945e5473ae68cc380d3cd8f41 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0766/1541] 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 52dd5a0a5cf5b243189f56debcfceb088edd66d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0767/1541] 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 047c5b520dcc69a765f34be517cdfdc733553fa8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0768/1541] 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 fcfe6a4c0a8785d38dd2c2ee3ea04aed914cb2d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0769/1541] 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 d08e655d0fc1b8b13a73991e12c0bed2ae586cc8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0770/1541] 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 f49fdbc0562b425a8a0c323742c51a36bb765f47 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0771/1541] 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 61886a158c8395de7c408764384a0884471d73ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0772/1541] 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 40d96a676208ac09af23a699ddfe593f6f135301 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0773/1541] 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 819f142149f5093bb915d122a24bb51feeb58b28 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0774/1541] 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 390c7a3e41822df408794526c04eb714a0de88d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0775/1541] 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 3f5ecb22d4c5598d2662dc6a548fb7a609fd7921 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0776/1541] 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 5a37ffb8fff0446ef9018e1fb51b51f5d57521c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0777/1541] 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 ff7b7207ddde129cc0733a76c1aefa7ae6f291e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0778/1541] 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 62fa331552f89a3b68d7c80f30d22d53107ecce3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0779/1541] 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 4b0a4bde048b9cf250e52cb70c25c4d01ae2c226 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0780/1541] 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 f70bb227aa85d8e08ebb6149ffff5cbd6b3ed1e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0781/1541] 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 91e6d62095fdac81be20262753b3dd4d38dd8ee7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0782/1541] 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 dfc3d0fa39374ce8d7642bd2987e48f8459a7497 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0783/1541] 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 9cfd5c58526f0ad4e23c2985900d703ae9752efb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0784/1541] 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 2da705261a8abef7993daae7c35078ff1ab10e52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0785/1541] 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 52e6f6ed8bddaa9a32cf7cb44c825a5b1e4d1393 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0786/1541] 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 0e72b4965581024815a7de5ce40ca7a448c3c62a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0787/1541] 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 f116d843ecd9e017edefb411b9a3e9ba0bd3ab88 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0788/1541] 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 fee93ab9db854c882a1f7a6c8392617e2977dd9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0789/1541] 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 66cc5b23a40d5f560bf3d3bfc7d260cbab6ccfc6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0790/1541] 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 7c587ed69f097b248a5c59c84cc5866c40c7e099 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0791/1541] 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 70aa4a0ebbb2998d26429a421b6c090da94024b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0792/1541] 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 128594a3994c9615401f0caac2d77e065ef725fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0793/1541] 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 b8d27c5fcd8ffdd28a4bf135f0e9b79b3ca6f54a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0794/1541] 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 f9d96455ac84613dcbd15b4c2a0d9ba43630ac3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0795/1541] 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 1b3b6a53e602a2cfa303d9b3297f24fb7b529fdf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0796/1541] 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 bcc402b2002cfe892baefdb7d10321205a422024 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0797/1541] 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 e35590643d1974f6ecd8e2b2cffffae6bdf47607 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0798/1541] 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 76404e9d259367c830394efe13b1ce6e4b76243b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0799/1541] 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 1883c67f3654b2b00dda28be629c0a4084220a3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0800/1541] 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 acb0631e195f0dfd4660dc1bd62188de26d84c55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0801/1541] 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 cb6b4d8e4a5e8972d8c710532377cf646091239b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0802/1541] 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 a37d29111a8a20cfc1e828e181d925cea30f581b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0803/1541] 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 474e5a86b77431508ae0cfe721eba644a9c1f536 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0804/1541] 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 1865ecc71ec718e5c9cc0fbc3fa23aa621465e90 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0805/1541] 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 67fb46258bc924679093349507ad24a7a2a75b55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0806/1541] 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 3d6dbff9b924dc323056733ba0b1c372da1f0f94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0807/1541] 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 d1a9b906da4d67a0a34e38c02a054c18726fb1c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0808/1541] 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 36ebb4a59133ec7c6a1d21a2f8bab3aa6a477ae7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0809/1541] 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 9d5afd1686327e256bdea8ffb4f61b65a191c8e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0810/1541] 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 eec39e13bc2e1d8b5b99ce68c9321cc28f684b6f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0811/1541] 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 7b4033bac0f3ed0abea75052e80ba0b67c89f11f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0812/1541] 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 fab8e8f8412a7bc9825182d67016670008c26025 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0813/1541] 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 5382a6b78af954108e5c37567fa4aeabf204891d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0814/1541] 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 913dd701ec6cb70998c121027a3e34d080628cd6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0815/1541] 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 f8e4d920bc2068d881b4b93b77ec70eec5250c92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0816/1541] 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 c24fcd72e1f61e71643b03ca2d3071e592076625 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0817/1541] 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 0bf3a023c07dc83b1f48aebbb4f9f4432790d31a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0818/1541] 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 7e34e7cc60c1cfae2207203189f41d8b2fe1b276 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0819/1541] 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 0c1281c722bccbdc596b2ac6142c97d49b44875e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0820/1541] 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 56203aa23e3337a50789f238675b041476dee95f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0821/1541] 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 25dd880767ebc52fc1ed1883042f3428656ec87d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0822/1541] 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 2042c5529fdea748c5f745813009b5acceaf1132 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0823/1541] 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 2178e51de8717bb1d4640f86642c83224aa640e2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0824/1541] 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 6ec0369aa400e674ab49f2e88ffcc9691cabc76c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0825/1541] 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 a4c6fcd788850b39ee6d756ac9fc092014c3162d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0826/1541] 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 51c35ea65cf4a872ebb6c7c485ccdd20a54c33e9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0827/1541] 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 ac5af3a9805e3809314993d444f034002d80765a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0828/1541] 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 c791f102177b7aa00d6e1747e89ab541cd781829 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0829/1541] 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 265b91cf892663ff8f3fd6695a4212352323e4d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0830/1541] 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 75805132ddbf87d9cc0c2395f46d04fcf46da2d5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0831/1541] 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 a2ed8106172275927b72b64347c3979e8dbfe462 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0832/1541] 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 08d38f696798a5bc7dd392e2328b75c01c2254af Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0833/1541] 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 cf18f395b686cb95597cf2701e8c4bb73e99790b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0834/1541] 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 e79d391f5781dde44d84a66d474b7a450e4c1216 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0835/1541] 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 fb5bdd0e027a2b92d083e727ce841d4ca373d0fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0836/1541] 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 1aae597a860cafc7662f196b7bf2f8536f1e2f24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0837/1541] 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 78970ca63fc54e858c567319ee59bc547f8b8f53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0838/1541] 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 21098234fba64fcd66118585f6a5e3fceb14fc2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0839/1541] 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 ca7c729563d4a8b0ebdbd2d89505035eb5545175 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0840/1541] 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 c7058ae754539fa044c95a136605c7f71518074b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0841/1541] 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 546ffa3483760f932c11f09938d2fac69437540d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0842/1541] 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 c7c10d40672d44f945faaefcc4014f5411f2de4d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0843/1541] 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 d74876fb080cd1a92560889a901a51f162572d67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0844/1541] 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 42805f8851a1f5eff74791f42e54f27779c4a024 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0845/1541] 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 8daf0e74212cf56596801f627be98e506a54adf7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0846/1541] 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 6a89e0740055f19a91a7341993b25a09ce30db5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0847/1541] 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 0685f933f1bbbd3e0a984e19a897d960f9dc971d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0848/1541] 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 5a44ab5bd8a5be79c8148868f9c83756e4a2be94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0849/1541] 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 1c9733350cd91cc59ddd9f82d79d168053bd5ed9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0850/1541] 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 4ed8e609d71db2347c4b859d7fcd0e0e8cc46e32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0851/1541] 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 a1be433b31546cf2489d95d69f53442dfa95dd1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0852/1541] 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 210d577e413cef7be5b6052f7b983f42ae6bce77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0853/1541] 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 8e7ca83635ecc9b406c886cc7ceeaadcfb96d93e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0854/1541] 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 fe96c13b46bf12d77f87e3415fefbfef90958a03 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0855/1541] 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 af4a9e0575259f768a73d8c87f8d48a5805eae6f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0856/1541] 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 34b26a79714d219966f893271f7f189135c2b1e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0857/1541] 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 59eaef4161bb924536e2e202c4959310e0a9d6a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0858/1541] 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 f71f7b6b0712dd020ab83aaefc96e69b7ac3a6e6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0859/1541] 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 8621b3dfa1bfeac3348c38e225e405fdf0a94e46 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0860/1541] 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 8da02a04c6beaf958d8baf44986c6fd65678545a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0861/1541] 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 958a9497e1a47c581eb4eef9379eca87c56d6d0f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0862/1541] 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 5b9dd31c40644ca86a5364402ce78c11c7bf5bad Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0863/1541] 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 1dbd5481e518df52c75cfd250a126336855097ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0864/1541] 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 e36f94543cb67fcf12cf202c21172e441b59ba98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0865/1541] 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 841926e414db814b7d063dfb7f6534e24d21f9bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0866/1541] 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 f3582954c6e6899dfee7f4f8aa7dc3d339d15892 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0867/1541] 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 30c54a94418e71e68ebe9758c48b0e3c9ccc7d12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0868/1541] 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 1c685f264a8da910e96da8b9080109c439b7dbb1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0869/1541] 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 0425c1d425aa8cef785a251bf108a13c0be67fae Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0870/1541] 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 bc690f22bb618a7a932f8fbf2ec066d2a44229a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0871/1541] 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 a906d90b08c020861f60c09d17ae4571a7438dab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0872/1541] 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 2b4078a574c31ac17e8a6440405f3c38ef4c38b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0873/1541] 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 368e92b38221e660a8eaf31630d435b15486ac3f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0874/1541] 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 c21e206f0ba58bd25fde5b4de4bf50cf744005d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0875/1541] 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 487a52b7653ac073be89310be14a1e99d4621d18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0876/1541] 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 f55f8576d56fc04be87e493845095ca992115b36 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0877/1541] 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 87bc8e9600366d5c84794097adc50c0d191bd274 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0878/1541] 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 8a2cc03d1faa6452be147b26ce6e5bf987de739e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0879/1541] 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 ebef31769bffe9b785fcceeaf37c1e05cdd4cf9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0880/1541] 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 bb7a4b63fdd571a176b782bb0d0c85a25589b5a1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0881/1541] 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 702262e265a06728e3b32ab1eeab7c3b40b4b705 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0882/1541] 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 b5c77e717851a79119421b39a1f74d055879f7c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0883/1541] 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 c36cb077c9c81d857f6fbbb0e23541f34e5d3a51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0884/1541] 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 c5965825881b46a2b09be4a134acd72a5aa1dbab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0885/1541] 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 12aa827bb94575b4ecba0fd6c16fde669f3acbc9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0886/1541] 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 4e01a7373141d8c7e72a1862b855364860ce6bfa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0887/1541] 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 af4d7f9caba227bf1c22c0759d5890c9cd9a35b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0888/1541] 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 c99a3f8c8db9557cf15cd77b6f8be5f4b9899d9a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0889/1541] 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 2cc5aadd268fc342efa72db05011871fae6a2a9e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0890/1541] 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 f07ba13557f20e712da84d610bc9d51e38dbb3a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0891/1541] 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 5b1b2073f04c32c6cc44d23709738467ec4628c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0892/1541] 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 66413528571271a56ca83193e4c81d31d8ff6e76 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0893/1541] 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 de02c8798f95a562c813b40b2819b6a3368f7254 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0894/1541] 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 e5a5a25b0c23a22ca4e3b48fb457ec89804d2fdf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0895/1541] 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 37c82dfd49811b1aa77432df5a28a814692548bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0896/1541] 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 8340ba6bbd5929144ae7458525bcbf943deb7de9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0897/1541] 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 e7984215e0b9c5c3209ab3018592d26c382c597c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0898/1541] 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 bdeff63f2f69d8349e4dcad6a2d7bb8779ae4a77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0899/1541] 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 45fe921b7cb407cb9e3e7af0c5497680a3614914 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0900/1541] 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 a212be75beae13220c024eedbbca31727fc277a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0901/1541] 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 63675fd3ea1dd46c21b32170a940b9019b494a53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0902/1541] 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 4fa650dd917b7b45dc303a4aa419a26c15c2da5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0903/1541] 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 3c4c0d94df94a346af20e51f234de7083e1255dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0904/1541] 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 e6bfcdfaf5f42c30da3ae79775e323a28048a2e3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0905/1541] 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 3e748d3ed6e17187834d128e478480b7e0621f63 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0906/1541] 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 d0b4b4063acd2f03356d00abe6cae7fa5919aab8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0907/1541] 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 f5085c76c1ec4b50720547b15bdfedf50a9944d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0908/1541] 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 aecf483a7cb2c5c37a2909363e08a25b045d678b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0909/1541] 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 3d205995ef4519c750829c94d801aa4d07e320e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0910/1541] 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 fdf6602201821cad3aec90567c8917904ced8a81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0911/1541] 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 f597e5ae73ab8315e8251e5b3d3dd17bfe06e557 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0912/1541] 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 3dec9c01732d16111a56dafbc2085b94b702800b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0913/1541] 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 6865ff8e9fd70f1fed700744adebfb90bcd09c02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0914/1541] 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 c8f3a7da33a7e13f5f3ce87a2b7d7063b5a8991f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0915/1541] 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 17d741071e758a24c51d0c1f4cd90aa7a0e4a896 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0916/1541] 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 2e531ad22d784354d174262fc83d760220e3d900 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0917/1541] 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 e4dbfff35afbe9ddb753a5ccb25afd6982b7eb6f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0918/1541] 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 de340bbc9047eb6525b271176211c44b9606f6da Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0919/1541] 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 69df29842b7fd2b26b877cd20acf606180390713 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0920/1541] 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 5769ba94d994b5cb9928e0fb532fe383a54cbed6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0921/1541] 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 b8b97d9a4248a1191ca9cc0ede61d4d99fef1d20 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0922/1541] 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 985795da17b818f20248e711f07919f98eaec68f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0923/1541] 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 6e69e701da43a1d8f15f596664b59b356cb2fff1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0924/1541] 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 581d015fb8930fa4a4c5cde1a7472fbef5770ad4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0925/1541] 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 47c28666667dc39c1d77239bccdc13b6f9b8f2ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0926/1541] 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 77dd58fd8417fad4710d043f340e735279b0c9de Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0927/1541] 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 9ad5ba99ed02571190e3030f337eb564402d6d45 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0928/1541] 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 78ed32472ac1256d3b1e843effd5955654012b1c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0929/1541] 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 c9a790853e988661ddd323c461e050caf55dc917 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0930/1541] 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 d2d19592ddbcd5ec5d5ffe29d2c1a7dce63c8d69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0931/1541] 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 1ad0adf3a6df89f5a05a9faf8d59d3dffade2cb7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0932/1541] 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 d83087b63b9d2d4c4bdf9efbdb9724bcd9585ae2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0933/1541] 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 134763f41f87de30285186069119ec98ef135e1b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0934/1541] 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 4c3d4f85167b68a282aa51ec7cd14bc23e2c4e3d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0935/1541] 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 296dd76eea0f481cf526c782602baf205b9c410a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0936/1541] 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 6579610e6cb2f4bac858af221a60574b5a9b2416 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0937/1541] 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 c760889f9a4d78e81a69d5de6aab2db559ca6de2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0938/1541] 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 c0104127613f9a40bab000ea965d29bc4b6a312e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0939/1541] 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 c49de63c58b078ca5e7615ee3ff0fb02c76d2c17 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0940/1541] 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 3b901bd97661aa6dfc610dae21b9675938561620 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0941/1541] 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 ad6dd43b79f1d660a7ca3a007d3a54811c6b09cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0942/1541] 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 e6b498d0b23137d7289ab565b2471c1df13db181 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0943/1541] 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 4d557c759a466a393a3289e4f7565f40984a6674 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0944/1541] 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 a8c1263e7d108e1b2202d6f86b36a5b207e53a32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0945/1541] 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 c9a84d7f85a2b728dc816d4daffcf6e1e48611ad Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0946/1541] 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 d292d76fe95f0a5b1c3ca166eb90da6978691b3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0947/1541] 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 f6504abf04575a6b1f163b142400f134d72120fe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0948/1541] 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 b8251485a733e588ff713f2f0263ff4f4d31dee6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0949/1541] 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 110d79f688631c12deaabbbb2ca884331a3651a0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0950/1541] 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 3cc2c503e68e89edcb029c5de04051366cc81c7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0951/1541] 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 8517a9b36ac78608cc6913425dc64372428c1e5f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0952/1541] 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 dc979a285f1c5d620a6dc248624ef9fce79ca27e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0953/1541] 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 2f3687962dfd7db7f64d8f3d2662d698fa548592 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0954/1541] 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 685a97017989e2d8be64de80a6bdc98cdf023508 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0955/1541] 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 65a216ca6910e65a96bd09af05f74383584f92a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0956/1541] 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 067ea98694889423d2420f7674db01c3d53a7dcb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0957/1541] 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 11e926f15477a61a1e4fc5ede7e764d5099bfe17 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0958/1541] 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 d37dd11c9126e4864ed57b7f3d92e0fba2f072c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0959/1541] 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 254867cf930c5c91db2b1d11f3778f0cd5fb08f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0960/1541] 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 86249c78115925793139ceb62fe7beaf870cbe44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0961/1541] 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 8857a85ee9e913cabd51bcf02cb3c8b057bad500 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0962/1541] 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 1b26823afd2ad5d16f41765fd000ef129bf89a3b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0963/1541] 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 e182412858b1f8ae8882fe6e94b46a2d14d2a157 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0964/1541] 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 9adca4ca4a7e63f56cc2cc6c840eccb9c01e809b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0965/1541] 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 c424c0ff9d6a4f63579ab605255f098484dda56a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0966/1541] 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 bcc67a2103abded0c5e65ff60a158e2a62e58997 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0967/1541] 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 b980a7d565a198ec62fa7c2953653a19fec9da00 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0968/1541] 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 84f76fb59a3d434b179b4a12c6de1c15c4f33e30 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0969/1541] 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 cdc6d78421cf4b2054df338e3145a7452c361931 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0970/1541] 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 a15a666ded98c525cccb875b11fc8ce97071156f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0971/1541] 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 f4c37068c730390994c93d9f777297846d00b801 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0972/1541] 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 a4f0b63ae11797bc918827eaafbdc96a82c6bf15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0973/1541] 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 e65f9edfe5c6fcabc3442155b2095e0e225528df Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0974/1541] 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 3c6f66772f4fa1b179b17c0434ea9b704e84e4fd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0975/1541] 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 7357112a375e95e72165aece7e9f2d2fdee42f02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0976/1541] 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 9ecee4cfad422d9671dd06d9f35f18f410c8d3e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0977/1541] 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 88422a86fcf63282532538eec335c4494a047983 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0978/1541] 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 08d958ead9a70cb360f5d7e61ec882bb8d59742d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0979/1541] 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 45f685319f18186b549b45dfc2bfc9638645641f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0980/1541] 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 f5b3d304eab3c6f1a3c3c122c7934a001882fa12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0981/1541] 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 226f460867dfbee4baea0fa7315b2578ff0d745e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0982/1541] 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 9802b92fe50be7ca1d9b5538fd1cc20f3b3023a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0983/1541] 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 dfe630287a4e8731b1f5f4c90edeaf00043fa8c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0984/1541] 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 6f8b612ad31498bb5d810ad33699e957f3daa3f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0985/1541] 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 21a1fc652f190d980fc1bd7a63bed170b8af9430 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0986/1541] 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 1d3d0d800b6ff34a6cc655f12eea5079fa809dd1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0987/1541] 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 8aa646343f9dcdde697145803358af7951a6c96e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0988/1541] 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 4f5c683071361cd19540b4d6f403515ec24aa087 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0989/1541] 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 d44f1f8eba970d471133eb969dfae1b88d6ad50c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0990/1541] 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 6cb98277dd25a4a6fa3b586e219b4bcb71d55d6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0991/1541] 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 fc93bd9d7fa30ed7b94a10a16019e9c03927d46a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0992/1541] 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 ddba4c47b0dca2b2e6789d34539c13b8bd38c2e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0993/1541] 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 b3fe783bbdc6f399874d91fa7e000047b63ba9fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0994/1541] 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 a323a375a4fdcfdc6de0d4b78c67b015773132fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0995/1541] 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 cf921cdca9cbf4b10193134de28f95e6d1d52701 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0996/1541] 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 ef8aa174bdd615554bcb5164a37fb9bba5498328 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0997/1541] 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 827c1c1d3757476e780eb68df427be01f575a0ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 0998/1541] 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 69668e6f8b6430d32af5f8ca1cec5530227a78bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 0999/1541] 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 6dfd3554a5b75b88c95ed751873a45e8ad217d18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1000/1541] 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 3f9255f2ca6a2c9ab0ef00f3e947752c473d46cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1001/1541] 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 4d99b7d80f713fba727049a6ee8488905973ba7f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1002/1541] 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 45571c5e7b27f40b2397fb2a7ead78e87e8d6cbd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1003/1541] 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 b9a7be9a3d3d66dbd6f4334037b0e04b8f316c9b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1004/1541] 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 9a324b57a1e11cfad49e92e33854019e3954270c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1005/1541] 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 aa95438f188827eeff6d2584dce5f57e5c3f2183 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1006/1541] 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 cca6da17734a61cd6e5ccfb64f458924f6c5704a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1007/1541] 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 33468cc8d8f63351d9c8652df5a5bb4074a407f7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1008/1541] 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 0574cbdfcd29b49b0cae0286f6296d9be24acbf8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1009/1541] 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 8cd99ce0facaf7e717616076e3466f53afee5d38 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1010/1541] 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 9214ecdc893dd0293b85e621a80e3729f920c053 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1011/1541] 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 a7bf436cd33ea71335da9a92d35c3c73bd2283bb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1012/1541] 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 725eecc39c30f4112aae6bf13efd84cb5c016690 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1013/1541] 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 83c236ad3c05624e3fd996f46217a9960ede704f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1014/1541] 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 a0a4ef3f9c8ec37af4c1e57b5c5bf4f193a2d58d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1015/1541] 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 e1bc6085a7c802a2ae95a8b0f2cfb2d4755632c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1016/1541] 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 fc7a8df6b328de3f3bc00e64ea63dda4950c0734 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1017/1541] 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 6f53a81cb1a7d8523e09e2ad440e622765c45d18 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1018/1541] 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 b9f09eca1e9da39afb8a222e85f44f16c1233c4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1019/1541] 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 ccbff67bc62682cc7973260c9b9057bd77382818 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1020/1541] 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 bb1162a0db65377ad7ac4d73118c072cb0828ca4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1021/1541] 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 918e5dd237711565b030414651353c0531d41b22 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1022/1541] 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 8cca7a24f662e12d8aefa54f4bf71bb9749d495c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1023/1541] 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 0e16fe2b58be269e71f020b6e79a4ebd3d27dfca Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1024/1541] 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 a575c40b4fe16a0039ed321ad6a3ab4e5fb47437 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1025/1541] 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 45ef4806286f6ece17b456f2e01d46c31cc861e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1026/1541] 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 5bc9a5b23d9b2cfebcecc6141fcf0275f67d2bbc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1027/1541] 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 5383698d8f5d967b795a1f3c7163f831589c1134 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1028/1541] 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 d77ad1c21bcb65a412c2840023eed2a50ed97911 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1029/1541] 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 e1ecc8ca25cd7711ce3c7d54a9e870a3cc26bc10 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1030/1541] 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 ced2444a7a9740e47bfb8d74ada3c0dae62b6049 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1031/1541] 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 07e5df8af35f2a45ad9eefde28c34508b38d3a08 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1032/1541] 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 75e66fbd12ef7fa3d137c6918138e2a0380d0ca2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1033/1541] 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 85f4cf2b5e0e6d8902c37d9089e123b920732a35 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1034/1541] 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 7c9668962db2cbfa1e23fda01c489dd219c61d4c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1035/1541] 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 14cf1c66495e9140a80c684c4c75533864419298 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1036/1541] 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 0261eb0c7cac274ce2d32a8771d544159a5ece0d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1037/1541] 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 f58e11e2926daa32bd7424d516bf1fb7caaaba1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1038/1541] 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 21946f42a31379495682d1c1f515e28d56f981a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1039/1541] 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 82d8eb6e9462dd3265f820f83667647def394696 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1040/1541] 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 c9efc79e349b92d1e0028a617a20f36943448535 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1041/1541] 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 9d41f88eb15523e36b6b8572858fcb30f0d3345d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1042/1541] 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 46c192c3fb7513a270f745b9aef797f31f2af887 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1043/1541] 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 0284ce487b6dd3917e036cde50841a0a05278c6e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1044/1541] 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 437ac50072363b31eb40fb77a52597fccdd8e322 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1045/1541] 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 e6f352e27d2b3d1da354930ed711dab8f30aacdc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1046/1541] 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 795f11026d4f147b78fdac9c0b600e7aef31b982 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1047/1541] 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 8d8cfdfb2b0eef002f0e93a8e04df551ebe0d584 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1048/1541] 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 37c5a0850cd889d4b79d0a166199bee2a9ff5c5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1049/1541] 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 9add345455dbb33d7ad1e3325608f294f197fdcb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1050/1541] 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 7a852e58f0a0aa61c6b6cdb724036b69a6b1ff96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1051/1541] 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 951a8a83999d8e3f9923782caa03c71e40bd6174 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1052/1541] 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 c12843b25fdbe7bf0ccff815169f2f25369f056f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1053/1541] 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 91ed25571c10e8e811808a255f20e37da62c10bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1054/1541] 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 118dd53465b6e0064cb724aad7beb82ca975b540 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1055/1541] 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 354f816beb0862688f7bba3056db485c62707446 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1056/1541] 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 eab6c6447fff78e77ff1043411e66340933114ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1057/1541] 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 e511b247cef739e53d57414119ad4e4eae447d80 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1058/1541] 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 037db5d99a2b88aa27c782d0005c7a13cab6ed67 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1059/1541] 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 3bbaad14f7a3d47b7a0fd15667c31b5c17e62e8c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1060/1541] 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 804cf37befd0f500ce0100f8e2cebfedce35aa3b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1061/1541] 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 d34b3e0aa058fb9029a6076c5a2f1d5b9416fcc8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1062/1541] 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 3c95523e8ae7be0f6c589e30f1ccbc397aee91c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1063/1541] 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 9d15a5f011e15c4bb4fa18a42b5128eb23fd32db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1064/1541] 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 319a16ad8c042b59a92ff03d04d8057b28dc416d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1065/1541] 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 e2059c9b705b59149d533b33b07c4fb17af87a93 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1066/1541] 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 88916eec070717b21910cc1ef140a79f4cb07851 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1067/1541] 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 f3038a01cf96791291fc156e78090d58df77fc96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1068/1541] 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 50d5e4d595e676eccf2f40204f32bfbdabb6f507 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1069/1541] 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 4c2bbdf6e5789ae13a5eaeb493263638388b29db Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1070/1541] 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 2602b581ee3bde13e53898ff639e6890031ef3dc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1071/1541] 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 5a526344427eae17b48bdcff7c2a963f24a80f8d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1072/1541] 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 b7cf9b4a2b32bf73252eaf7b9860072ea5243ed6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1073/1541] 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 f9383b88474d24c47e2b2bc28de4b1c13227742b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1074/1541] 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 1aff3aaac756b0f517f0f54a6c1d53a4aa376bfa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1075/1541] 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 a0212d5baf405605c6ee606555883e98824465d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1076/1541] 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 4f76f904bd6f6690e43646190a97671e7d5efe32 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1077/1541] 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 8dc5a32da2172a2a39f3cf7c9ef2b58ea2ecaceb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1078/1541] 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 d8da81e795cc3a85e20c47bc058c352cf0de3137 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1079/1541] 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 f666b5364723bfb5483450bd2c0ff73ee42d1d58 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1080/1541] 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 48d2995b01566bdc724eaab22e7d93e0c930f581 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1081/1541] 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 adadb1a25b2ed9ac101a104f91646f7791365f24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1082/1541] 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 11e9c174957e86434cef290ca5c4e31e47370c7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1083/1541] 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 63c31e819efc7b602294ecd9bca052363d731d9f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1084/1541] 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 906a455cef5e08c02302d15d27fb778339a5bd09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1085/1541] 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 da4f9f9a07e75c318ea515cb5dc6094453726c7c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1086/1541] 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 31470995c301a2e4d77edf8d620be6c76a0943e7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1087/1541] 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 9580a7cc357a45a9dc3f3218d57c7fee370330a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1088/1541] 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 6d71295495171d3fc3b0dad0715efa60d4fbbc4d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1089/1541] 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 5ba4398eecccbaa6b3650c2c1ea26c97d5c76f98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1090/1541] 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 a5da10905afc1021326e08a814c9802a811fdf01 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1091/1541] 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 9f44b6981e4b396126bca57eec066a1eeab5bb33 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1092/1541] 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 aa26362a06a71da03e75b545d79beb637d9c4485 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1093/1541] 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 0bd56eddd102743eda2e6a3a2fb7758483b722cc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1094/1541] 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 f6056965c5bd7d53fe42fb6dac118ff01393af02 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1095/1541] 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 fffa6a066215d6b052c5781d498270c71dd8897b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1096/1541] 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 412411e47bd18df57394342eb5b3ee475ec54aba Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1097/1541] 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 6a3ffa7dcb7569230b244651f8329cdd0676eeaa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1098/1541] 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 aee89a58de655b3f0d9572c5165fe7788f98d85f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1099/1541] 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 f1944a82ca8ca329dd6deb531dad3cb8fae91dbf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1100/1541] 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 bad2c03a67d26eff7c545d15c16f5ef4c252e568 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1101/1541] 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 d48f407fb2db46f376387fe001b8b6660454c0de Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1102/1541] 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 2b66b74bcc610294eb4e9f4e48008a8544aaa143 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1103/1541] 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 8310dc992235feed4eba1b2afc56943c93efb2f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1104/1541] 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 4c75f0e2ec9631b8606f12da0e5d1f2f124e6f7f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1105/1541] 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 9cdb37b72de2a61d6ca9d561b775fc0cf4fc6d5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1106/1541] 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 0858e271f06465de621e3c61cd488712bfdab229 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1107/1541] 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 c0b6c2ead335a7216562eff5bcccf7677ce654bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1108/1541] 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 ab12eab6b36909c193cec53c309d8648d265448a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1109/1541] 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 76dcdf33b7db35d6b8b2179608956a73e5261006 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1110/1541] 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 bedf7e663ef7c7fe57c682c1e02bf665451cd614 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1111/1541] 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 049336e0f6338bfffc571855140bfc2721aaef7a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1112/1541] 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 c8fa8ca1667307946f493aaf6e7dce865f6580b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1113/1541] 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 a02460dbffc8111b555b7a92bda11ba4fc04cb97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1114/1541] 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 10cd5416eec4f4972458eb9601374376cfaec545 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1115/1541] 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 d3839253be9878eff3c56fa8a7d490f694af1668 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1116/1541] 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 38866bed5aa1fb6233006b3760c0096eccd6159b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1117/1541] 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 dce0201a164095bd2fee5f815ea729165503e2ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1118/1541] 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 2cd5746875878d31a80fda03fafd626d5010c5b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1119/1541] 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 06e7929df5b3e18e969aa63e439b5fabc1954fde Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1120/1541] 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 5e13102ccf033983b6ab1810c52f99cd20b1c387 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1121/1541] 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 f9e5dc2d1eb1f894d5bac28546dbfa6787fa736b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1122/1541] 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 d0c7fbd21f3dc7748019f1da15361b2a3ca9a521 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1123/1541] 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 8e84ace8b0702947e95fd0f9701aa70b03411a05 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1124/1541] 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 e9ce08216cb3cd18acba8c7c005f9e9d74c2b3f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1125/1541] 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 4729184697d2823e024865aa4d035feb2ff3eed6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1126/1541] 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 07312632b4294a936f92bb6c2c1d87044a6aeace Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1127/1541] 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 309b73b1ec9faf339db41256da512d93ac4e71d9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1128/1541] 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 d04764b42ec806643337424e094d7c1ce43c1092 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1129/1541] 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 8197920e64d128bda7de73a15f5bac87bdd856c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1130/1541] 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 f8aed2048c0212c6222bb2cd22cf2b7198d34616 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1131/1541] 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 b69881bb1d3ae39ec0ec7d073f2bb094310969a5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1132/1541] 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 37ad76974f08241a99b5e7484e29bb75dd7b6355 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1133/1541] 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 55cf44a239a1914da0aa4decdb4680b68e197473 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1134/1541] 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 294a449c10b336d0f1e525e29a801b6a4cbea62f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1135/1541] 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 f68ea182305e00c6ae592b3bf29f5e2c39d0cca0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1136/1541] 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 af2d04946aaad79fdcf48b4af85fa865ae27eac2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1137/1541] 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 c304e82220f891add3f28980ff626327c9b85ca7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1138/1541] 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 437692bc3817c0bb714e929d7494cafd92b161dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1139/1541] 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 6e5901d9be0b55a7738e2a97ae4c65cd233011b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1140/1541] 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 a67f41527aa2868094d3d68eaa07e55dd3eee6ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1141/1541] 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 e299f41c0d5e5eb29888499dcb0365a036274fc3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1142/1541] 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 088766ca6cd0a3f6f62454096ced054c85391f54 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1143/1541] 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 0feaef5b8af3c0d7147b8ce79dfc53e647f94df9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1144/1541] 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 5b90adc2d794054eb5416534fac66cda34fd3a97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1145/1541] 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 86eac0c58e3cdbdebdde7ce76b9788c6f59b7e3c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1146/1541] 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 64ff3811ff5faf536923cf50d0a9aec9cc5188c9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1147/1541] 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 60f6180bcc873004170f5f0860cc2a98da66348d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1148/1541] 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 f4805e17e0921104c3bffa3a2d1c7665efd6903f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1149/1541] 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 61e3582caba22895fd153c245bb7119ce9d61817 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1150/1541] 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 db6b22b287f0ca7a0fd37c0264afdf022b48621c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1151/1541] 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 cfba6ac39c2e702bd00461bfa10b1dddb7dc0cff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1152/1541] 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 0b4bda39564d5f076e533d052303bb73751a8beb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1153/1541] 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 71b60d4b4e6e7da7e477260b1717d7ddeff9cdf6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1154/1541] 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 e45c87100a1d2014c77407e284a3109b7d300e8b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1155/1541] 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 4284768bf92a84ed364e1b884f6fc47feba10102 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1156/1541] 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 fd1fcbcdb46f7dfcdce4c3b9ba99fe17f1c30461 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1157/1541] 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 2feebe359b9b2e5cf31eb53bf999fe88a5c771e5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1158/1541] 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 98964387de25835b3c7ea17cfdb7f4e151ad2afe Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1159/1541] 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 4acdfc5e7231ca8bfce976ac49d08353adc204e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1160/1541] 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 7bca5df1340f55b97029c8d297e57cf4d3489e2a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1161/1541] 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 625a991f41df060dbdedfa1aa89c0fa6a0f2911f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1162/1541] 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 23d147a3ab40a74e3aea08e329a391cff2973343 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1163/1541] 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 ec2075c0e2475ba2d95b5a4de97244886e21b0ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1164/1541] 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 2e734cb3ddd9b866b26ddfbb23ee44b11867a04b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1165/1541] 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 10bdaeada4bbddfe73ca3a5761663f195f01b2d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1166/1541] 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 3bb5d678cb94fdf4af32084e47e0398bd5e03a69 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1167/1541] 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 1627258a6dd41f46d8d185df6300241e0cca1ed8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1168/1541] 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 cbfd5cada090a4024d136f08efe7b767388b15ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1169/1541] 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 4cbe8081435b7871f957c56ca60b01d66ae4c5a4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1170/1541] 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 7f34d71b1f2cfadf90b0d5b50c4f51b947d3caa6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1171/1541] 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 c9ff220aef7c9addaa72b1c5b163f3fddf587896 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1172/1541] 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 89bb9b30ae95fe197e4fb75283757075499b1bd0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1173/1541] 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 89f46f68f49be838303823c64295d004c0048ffc Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1174/1541] 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 82f9ef2d2fc6a827e0d33ca171c2e99a159ed237 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1175/1541] 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 37fcecb8b086c90668de0d12ca3e1832313c444e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1176/1541] 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 1f2329105a0477da8e0e44ca405d866c26f330dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1177/1541] 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 16fc3ce777b9a9f0f7f255eeb6c75af0158df4de Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1178/1541] 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 abc694707eaccc1a90847b4917bb7fa4b5e21c81 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1179/1541] 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 cead8607134bd2b8048b70f55251b385e0b4c61f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1180/1541] 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 aca4ce42879b396542a1e9662e1459f2355d6485 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1181/1541] 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 f06e00e3956702552f381af378c6baba1f373ec0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1182/1541] 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 c1dee9af40baa5ed23f1e60c965d24e06932d374 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1183/1541] 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 48e3f1edaf4d42ed200252ee6f4397479681e6b4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1184/1541] 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 51c7da415bae10c69b736cdcc2e96eb57cc3a421 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1185/1541] 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 d8e54c6ff157b33b0ddbff88b1f4420c2c9db056 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1186/1541] 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 b10b07917ab54c01136bcb7dddef578d306fe128 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1187/1541] 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 5181e8242cb58559e03117e7938ab5ee02d5a574 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1188/1541] 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 8c12d37b30edf62b67af5bc4f815ebd04740f676 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1189/1541] 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 87931259c77a815d06a5e9724e804ac2fcd460fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1190/1541] 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 9aafb8063ea1d77d2e49d016918c06d6e4b294ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1191/1541] 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 53f60eab9971d0fc6244936cca11a56923c48a2a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1192/1541] 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 8040b3207938c21cf3263631e17e20d6b5b7aa7a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1193/1541] 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 0330bea4278f204a58e1f52397ddfe1e2f0dd7c0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1194/1541] 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 335aa254577af14aabd15e3dc0f41558836b72c5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1195/1541] 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 0efe68d9634ccf79ee1b71b948b20b7199aafc77 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1196/1541] 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 6ea8555cbdc4739b29a7bef672efb123ef4f5f73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1197/1541] 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 da47b35568ebb671b17efcbb4926fe3dddafce70 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1198/1541] 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 601f50ffd861c7fb03fda4ad6c0c7539a9a8aad0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1199/1541] 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 01a2578e444ebe6fecf31a0fab0f47b58f8861f8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1200/1541] 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 72860ddc03a7245d902b8b266b1e819b2177ad49 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1201/1541] 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 eb3a341aaca7263c7681febd48b1c6959d0cba0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1202/1541] 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 e034dc5d16e422940b9f0728b14b056f546f9a3e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1203/1541] 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 581f4a71b6135586250b86c1a77ee94ca014a121 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1204/1541] 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 e34269bb6d03447827a7533300ab2ef2807c94a7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1205/1541] 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 1448a3fe7f747046823ef0c51e6bbf9a08150f94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1206/1541] 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 e656b15c619d50245405b85dc3e629c2764ad9d7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1207/1541] 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 3bce695c710fc7d6d5bc5bc7228c3a2f3c44a50c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1208/1541] 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 1ed690b3b380a5af5b82435c2d2317c486c401d1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1209/1541] 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 999da5412604204bbbcad96c4c66f0757f39d5b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1210/1541] 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 53c8aa555cd1bf046f09ef16162646a417baa223 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1211/1541] 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 087532ad3d5c4579b3a51f4e4581069a8085f79c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1212/1541] 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 55e53c38417f04a7a5dff65cbacd5c0a42f38608 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1213/1541] 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 3512a6fb8f9ab23adc94ab2e46487d6c0970e67b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1214/1541] 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 8e63f39ffcdd730cab4921c335eeaf6cd3b9a78b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1215/1541] 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 8949c99d637c9fbc5c4984c6cd59a3ff20f6adfd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1216/1541] 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 e202905e0060fb9bd117c0a1bf8757eb0f47447a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1217/1541] 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 dda6ab7d09289a8d63f1239030e8b5fa38a728f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1218/1541] 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 e002aa5faa5ed362779fee311bc22f9585d071e4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1219/1541] 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 2152e1ea968dfc52808abcfbccd2764f7d88a2cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1220/1541] 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 bf961311f4c9a9bb800a69fbd2d80236d3e03016 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1221/1541] 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 92cfefa44ddd94df954246da3f9bbdcfd344544d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1222/1541] 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 52672c458789a39045b4c63252e3934c76d4250d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1223/1541] 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 08d14d1783e8b2d2089640880183b3c645f6f913 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1224/1541] 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 fcbf1ce116ae441211103c7cd09a4199c0ab5582 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1225/1541] 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 df5c4c76097312817a861478277eb3caf360a319 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1226/1541] 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 942c5c2041293138dce13f1e5d72f2803249ee75 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1227/1541] 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 2e841c2147fac146b0e2dffd985db22852d98b24 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1228/1541] 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 40a595b9ed13d37fbbc154cef3b3a16ffc226944 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1229/1541] 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 60c8cabf87dfdaf5ed97b2ff039dedc3d840f7f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1230/1541] 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 cf97987c6df5528a083086285a9267c2fa0af944 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1231/1541] 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 bf530af2349be91c33740439e6d1122fa7a098c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1232/1541] 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 5b28fad1caa944cc47f815bba12c023449bcc5ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1233/1541] 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 702917a072d657a5469df891caf118ea933ec534 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1234/1541] 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 07f039b8764bbc7c6bc4000baa8486f0e5655200 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1235/1541] 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 bd24440e203d1502342d3277c7efc1824b4cce9c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1236/1541] 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 9b52fd0778adad1eb288d892b2592c85a815aa34 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1237/1541] 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 13536ed9507f31b64ab24ba203ecb78aaccc7b3a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1238/1541] 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 2e5b224fd64985c812cb1e836190afb1a0a6ef7c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1239/1541] 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 0ca205e94d25b827c466e7163ba7d02b3ecf8473 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1240/1541] 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 fe50c22e9c8bcd2b5646663b6954a21d61f38855 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1241/1541] 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 ab81911c6f27b2b1cd7afab5c6d7e6dec2ed24c2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1242/1541] 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 14365d225da132f55e70f44e4ffa002f597224b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1243/1541] 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 ec631773547b3a2da2a08e2edae3abca4614ba74 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1244/1541] 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 67784a5c9332d1d5109dd44534f0144871becbf7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1245/1541] 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 042f102e3492de6944dfec9cdd96a378744eb34f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1246/1541] 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 bd7685c969763fa4b34fc0bad6e00d342be891aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1247/1541] 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 e316b4ccc59ca3c3f37b230b32210f65e0d45c23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1248/1541] 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 27d569746b8aa57e4876f050faed904d426d47bc Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1249/1541] 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 0329b49e62bf6b750b5d78c5c547ccace23baafa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1250/1541] 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 2acc0f7f1463b0bb1b924501ec4e116b829e7f85 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1251/1541] 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 fcbe225cfa2201ffe1cf8283934cb2d5ec91acd6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1252/1541] 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 e111542cf8e1e19fe99520af3b819642dbea83e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1253/1541] 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 7ff87e0ac97d70e5dab1e69fbd56981bcdd9f086 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1254/1541] 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 b989b5aef08eaa24d84ee541eaef58e2dd22997f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1255/1541] 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 95da3cc6c17e57ab75b13c73def11191132e11ff Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1256/1541] 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 16075c18f35b3639faf9104656a0c3762d19c390 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1257/1541] 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 df24100bf969f5f44722fc2fb8e460cf190eb744 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1258/1541] 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 43963674df7119a8c59ad892ebb65c1fdb254bc2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1259/1541] 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 3aa1538e34459baf4c2c95f8361bc5616c92faf4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1260/1541] 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 cab67f7ae5e23332a4d7eb8b39f9565465c464cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1261/1541] 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 8cfb47cf7610aefa9bfb98fb40e22883a846a96f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1262/1541] 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 6093ff24d752e76b85a5ad7e5bcb443aa2a73fc1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1263/1541] 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 aec45b72a4904974c5e09470e6bda3086f961f97 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1264/1541] 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 e141f1eba80775020c335c908b7aa6bf93fe9335 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1265/1541] 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 f179ad5d2a0393693e83e79a99d979706e1877c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1266/1541] 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 7739b1c5a6cd796f932c48fa1153bc42c9036376 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1267/1541] 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 35387e15b32f662531b269aefd502cb179ba4dd5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1268/1541] 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 4fa8cedf646ea821f0d7eb9193138e464fe424b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1269/1541] 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 5802277e17136388cfb20c2d685b5920f02dc79c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1270/1541] 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 fcc171c99d4633d194781a39301f1668ae5c2fb8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1271/1541] 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 20001cd044f9509abecb93e7d94a421a818451a2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1272/1541] 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 2a008cfb8c586ee60c42fbc3d9d974b61341c0ce Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1273/1541] 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 df77f55bf958078e50d7b37dec02355a9bf1351b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1274/1541] 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 d5309d3b96a29410f2a1ef68528141c940fcb468 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1275/1541] 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 7bb82714df30fd11f9d0f87d6ba0a3af3637e674 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1276/1541] 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 35cc76e454ab58a0aa1be79128e2fe5bee8d66b8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1277/1541] 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 1ba405352685eb91b4cea5088252489b4d2e27ba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1278/1541] 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 3341882faf5475dc58f35fdec77f2cf4b3dfca56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1279/1541] 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 5b6c8228ce2bb8a7bd423fa921444442f7ad3286 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1280/1541] 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 8856dedd6afeb8a06c064284af1a9c102571b8b9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1281/1541] 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 ff5e077ea2a489bde4bebda2916cacf4f21bb27d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1282/1541] 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 d1f675d10d2b9573127caba5eb858be2465b358c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1283/1541] 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 7b3889dba4b382e7856f88bfd974f1bd09406347 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1284/1541] 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 9337793db81efd99074ba091eb4d58ba7a0e4347 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1285/1541] 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 b574be040f60f4822b04bcb48f644a4f647b075e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1286/1541] 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 ff6fc20df5f16cf05e5953f02a500c4dc14f38eb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1287/1541] 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 74a06f7af40b7642106ef4983c0071dcbdc472dd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1288/1541] 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 61e7e59d2e0a785eea003104fa0700d6d22b71ef Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1289/1541] 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 de7930284761fbc1c8e6f4980b285235b55c3c51 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1290/1541] 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 9ecaa3862400636236bbfbff5eedd5d091031a5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1291/1541] 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 902c2444f96a73bb8c42b7a0c52074d9bfece55d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1292/1541] 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 50ca2890165272201a0a2ab107fa62367776b69b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1293/1541] 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 7dbe1df7c9d1a6205de4413f6241310be123dc31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1294/1541] 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 0881f8adf1651ed598a91ff690e8f4d2064687ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1295/1541] 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 334fd7b22a8adfb8dfbef93ff90c0dd9cc70c88c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1296/1541] 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 510952a75ddffb0dab8a852ce67e2a8d2ec362d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1297/1541] 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 236109f7198166511b0a8cad8c5dfe15f230136a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1298/1541] 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 09d42501108fe71c9a425a3b049f69c3e2b7d991 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1299/1541] 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 c5cfb88771ec381598126ecff85286156165e147 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1300/1541] 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 c8879a5689c0424ab5e42a298b122ae8cd27d380 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1301/1541] 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 50a12384dfe6ce9a90584fde0123ee1372bc8e0c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1302/1541] 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 f7e652fe253c4d9d7f1967ac9291659280e1d45b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1303/1541] 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 fb339b8919eb43d95995203c542b8099c9c75098 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1304/1541] 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 9b7e07ac50b40eea06954e8f560d53d942ba1234 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1305/1541] 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 0177eb3e13b75c4f4e0f4c5cfe1d7de857f908ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1306/1541] 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 09f3fa11f40ba7b4960c8eb6a524fec40f22fe52 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1307/1541] 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 6c08af9598ddf56bff749224bd5ebdd81f8a542b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1308/1541] 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 16fb873fb1d52883c50d12ac1e4fcacae833aa8c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1309/1541] 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 def482e6bf995c265f062993b8067dbf9f888200 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1310/1541] 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 0f179919dc7167fd2e18c4de709bf8c413d2f564 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1311/1541] 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 23fb9798d0c3ef2ed7318cf29a668f502c2a825f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1312/1541] 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 4521bafa5de186b8232261fdd0eddfaddbe66564 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1313/1541] 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 6a84b0fb3a2123422dddc5d013d1694e539f6d5e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1314/1541] 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 2bbf5c3a1a3647f6c64d95dc24ccf2723fe93bea Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1315/1541] 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 925723e780a2d413fc33664fe5aa2f5b2275ab07 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1316/1541] 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 de7d7fcbcdd67395e44f37ca7c3dcc59cc515a9d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1317/1541] 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 b8bf53aab31f3efe25ec24c71602a210f34bf26d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1318/1541] 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 dc4498cd253242f68dd668813064250d9860d04d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1319/1541] 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 38f01ec27d87159b8c33dbe4e1dbc676aed539f6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1320/1541] 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 e72f5ec53eb57651fcaaaf18a02bd9d393be8ba0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1321/1541] 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 91a5ff07e1ec064e7e8fe7fe62ba82750b2e1933 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1322/1541] 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 a618b76b7b2c818bad3bfd59c233a0c90d1c6950 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1323/1541] 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 389afa192b9e0dd5f2a2347d4de3449a947039d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1324/1541] 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 5b9e051ae63f236d58a4aca99a70d83382aef107 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1325/1541] 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 d83162c7b5faaee8ab0ce72ceb8d4d8699852270 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1326/1541] 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 a8c7bb30c01b175ba2706c02a44d84a80934267a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1327/1541] 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 36bdad4fe5541bf096fd7ad31bb080d72f674aec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1328/1541] 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 ad16b81b48bbbdac597a6a9ea6729c37cb4fb40e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1329/1541] 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 89485b59aa68694b98ef4e1cc06ba1557d790f2b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1330/1541] 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 920110d2ec535a6efdd1fc977e04f26af93b327d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1331/1541] 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 efab848c8458cf8b6de9f34e7970a3f424364d53 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1332/1541] 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 8569f69b1d58a6d9d44e6d42766a0485db78e4c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1333/1541] 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 ff9a6c3b48b64b0193f98956014240204abd5b7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1334/1541] 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 011b8fed3f24f9dafdcf5bb1221f7f05cfb8d6b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1335/1541] 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 815df2e7f4355c32368554a3329d41b436fba9bf Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1336/1541] 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 b387d32d51995f511639c6904a907652e76b3f12 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1337/1541] 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 6e974207ba61f5ecd0c3d4da3bcad57463f4930b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1338/1541] 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 847a91b46196b2d1dc4551d90060761f7120f206 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1339/1541] 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 f00880804d5f07ef28455a97654cc4a42dab2938 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1340/1541] 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 9cab5d6db4f255f55657c9889b53649ccc515ff3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1341/1541] 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 9fffbe93f53f1ea261cc5eed37954ad9349c3c2c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1342/1541] 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 76ace8aab6d8008888507d599b12bd410cde921b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1343/1541] 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 eb82ba82471907f905303d3a5faeb58a8afed3b7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1344/1541] 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 e9334ec938fe5b8dfe62f7e2b934b1d97fec624d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1345/1541] 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 21b6bc74d03543130f6d2c11dc78bbeeaa58a4ac Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1346/1541] 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 0750a245647f7a043e4f1cb2a495fd2693dfebe6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1347/1541] 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 d6298354550582d244d207d9da40e59161a3d608 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1348/1541] 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 4068cdbcb682d946894fb407fdfbd31164120c48 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1349/1541] 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 f099e88c1ecbe1af16d97e7c4621161ca514b070 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1350/1541] 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 9b560ff9ee9479cfa3c7cea84eb3c7f23bf5ff2e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1351/1541] 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 88b5be7de6fc186fd005b11039a437d008c64289 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1352/1541] 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 edd5eb9b59fbbb883fba4967889a22b9ba2b3c96 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1353/1541] 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 341e7ade100954f2b37dea3bf4c569af72bde721 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1354/1541] 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 ce7fb747f2290d35254c0f0929e1ab30e259ae13 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1355/1541] 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 5c3bdfe2e76b85b2a4e4099196796871931b5cee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1356/1541] 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 9b506f5cb781eebe9780723e9a2d7090b13a9e15 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1357/1541] 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 22310454d3b54d4eb02d2ac9b89ae58454e54485 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1358/1541] 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 cde3b4ba0d099f8c8173ef088ba28ea561bddb5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1359/1541] 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 1072e4ec76dd521e9b5ff8263775fdec80c5a712 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1360/1541] 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 63dc930e7645e4ea4896bbb1afc2cdf25d3f3196 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1361/1541] 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 29699e9e28c146d5548eecbeb3d4a712f478bdf9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1362/1541] 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 dcb32acbf64f90308013296fc408c029709a05fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1363/1541] 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 cd16c7b6945206887f8fcee937525d761f5fca40 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1364/1541] 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 cb958400c348e6a4b8775058cb53167ef967016c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1365/1541] 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 10995930e1309f77c449924519fce5f33b888724 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1366/1541] 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 9c111583ca670faf450c2252c451994db3756e5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1367/1541] 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 0e5d4eed25d545352511f0d819f2f7ffeb7ba521 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1368/1541] 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 81a0b52f05662128cfb4cb6ef26952b6d9aa85cf Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1369/1541] 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 c0d5247d741d02b5eb5f2e7f863485e96ebbedfb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1370/1541] 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 c002ad688d02f78c75719df88236a035b3067c2d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1371/1541] 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 285fa2b9d999ef6970394be1a73356ed95f3bbd6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1372/1541] 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 d408104d14b5de8b675d67606cf59473d7b24a44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1373/1541] 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 466a4e63bc3ed0c56dacd95b2eabf3590583a25e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1374/1541] 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 ac1ce8ca032029812392a31c620da759b98a7228 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1375/1541] 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 424e0f5a50d8df7acdc513a9cc7d029bbb1abfa7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1376/1541] 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 edc1de4eb29ed932e66ae893dea296eba6a72259 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1377/1541] 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 7338a42e64fff012789247366a26d815426e6e7b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1378/1541] 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 1f6bb77c19ba70af04aa35f1df79c1669a48017c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1379/1541] 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 1f4817a9c7805eead903c0e22ea0e5e75d21a028 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1380/1541] 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 2ec3ffb2fc37567d84cc514c04e85907e02f9bab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1381/1541] 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 0eb25a2e897f9d7b377cac578853144fd265c5b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1382/1541] 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 e4b2604bcb2dbcc26eb3e2d7e7b43c347378fa5c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1383/1541] 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 025b48c6e7ff0c91940729fbfb6919d38bcb197e Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1384/1541] 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 d980cefa78c264c24a2b748a54221a524c1feee8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1385/1541] 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 7df65b3b68a6b05c6066c84d2935d2c3c57a6952 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1386/1541] 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 e4af17d4429bb2972724dcde7a6ca7d9a91eecdb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1387/1541] 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 37ae831a3f1f8cd294cd313e5391e20a2cff9bd1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1388/1541] 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 fab0b74d439c287633432fcacd2083a2c092b108 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1389/1541] 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 d2d0247105d46bcacda698d8ee2668aaefad7047 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1390/1541] 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 7c0e45d88c48326b3b87f228eaf5eb590385c37b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1391/1541] 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 9a494cec20cf597b1c87adf2bcbbf4e267a951c8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1392/1541] 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 9590772a8ee25548029cefe02ab1f08e6f9cc25c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1393/1541] 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 19b9309bc1ca19e2b04a230c02e4915a1993ee04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1394/1541] 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 d5454b6842d4e61cdfbd2beb006798198a8d662d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1395/1541] 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 60f0e4e4778c7c22c9d4db631be4058cc1803723 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1396/1541] 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 acc4fed6f834474dbc1bf8e50797fbea57c57a17 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1397/1541] 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 0718c0cb8a1a11ec10e6054eb6bb6b6afb032dda Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1398/1541] 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 ab03924d4a30e6ea9bdc7b6748dcdba15b1748ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1399/1541] 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 923f56cff1136b342d1e4ab753359a152cc9a5e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1400/1541] 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 40e66891f7d99cb50947bfaadd3bb7ae7ee461d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1401/1541] 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 7d71f8d8b3e3625905f0ed41d4175ce25c941070 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1402/1541] 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 17501395312d93d435b8aeb14abcfe048656bba5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1403/1541] 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 f09bd402e9116275993805031486296098df7e1f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1404/1541] 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 045794a3c5f18b28ae47d9a91cb2b4680d3e3c42 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1405/1541] 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 4a03a5d6ac858cda734bbb19dd158fbc2822011d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1406/1541] 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 e9b56e0b9b7ca468a673988a4f8d67a9fdc007b1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1407/1541] 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 8bf56d4e99df1a78e3811ced1a41ba5dfa769c31 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1408/1541] 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 94a95f85496ec5f792b02608907657cee7fa66ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1409/1541] 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 4750e6d177111f180b1ad3cdca99d4c3c1b018ee Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1410/1541] 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 0e5557f3da079ff3b8fc8d75a81771e313244795 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1411/1541] 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 7b78f31484e92b228383c52bd86af5fb5e7d576d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1412/1541] 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 226a3fe6454dd7057deca567d412fbdb2de8d7fa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1413/1541] 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 ba5986db3d93c084ba31426971c2dd3271ce4ae0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1414/1541] 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 0ed4b57f89ac040fcbf0fae29ec18b4c905fc52e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1415/1541] 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 f7edd94f520398bc106681ce989ddc2eeac847f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1416/1541] 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 c0efcfa29e40ab2957083c7a9f5aaf1547e35043 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1417/1541] 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 372baca100154f4cfb5634264dde8b581cf76ebd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1418/1541] 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 f66c3bc0be45af4bc95c598501ba8f64a2b5a75d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1419/1541] 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 bdfbc5e57e2e865f2a9f89f0214842560abf04fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1420/1541] 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 1887e7b043ffb0f625767b344e629c7ef962ec56 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1421/1541] 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 741e8a79bb7898a3f929a2cb8dd30878a3251dba Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1422/1541] 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 3d25f402469f878501ffcf492bf3397a69f0686c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1423/1541] 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 2ea1ceda070a1361b3a00f017b820673a4b91eda Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1424/1541] 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 28f18d27f59acf2dee6403142d727b3b24b123aa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1425/1541] 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 e67301b47381d0a85f0d39014e4e61b266d33a03 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1426/1541] 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 d6d29fd7c515ebf4e0087c6acdd63fc80cd4b919 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1427/1541] 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 c26f05fade2362420fdb303b6ee592e03bc4e3ec Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1428/1541] 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 d3906dab3cac275b1eb61f219a63054ea189ce44 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1429/1541] 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 2263e8c0ce70328e967725a29fed45d37b5158d6 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1430/1541] 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 b6e4bf8777becb445a2de40cec59557fdb4d6e92 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1431/1541] 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 734a99b55f183554d30d7ecd379bc9325d1826ab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1432/1541] 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 fe2022743e856567bef66901b71558b59ace99f5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1433/1541] 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 a08f64a2c51dac10af83c0d9b945d11cb49547a3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1434/1541] 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 35941d51f30acf6d0251d6e10268295a1a3e82b3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1435/1541] 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 a3308976c5d95f11a0757cc092b5f65c6b1854d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1436/1541] 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 4e1bea9b0bd68abb70af252b0fcfa9a7836d8c98 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1437/1541] 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 cd8b99bcf1b49524412910221a5efe2cb62471e0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1438/1541] 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 e9acfdedbb09446e11af536ecd60f2403bbb0368 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1439/1541] 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 365f2face5c7d69268def21b07295ac8ba6afecd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1440/1541] 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 ffc94e7531bd125f8bf9d91b3ffd2375c530a96f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1441/1541] 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 d6ca11581d5e7eaca4c9a5b34ac54900be3f5ee5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1442/1541] 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 9fd1913e528c6604e6493f9f04e5f689d775d027 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1443/1541] 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 04fd82ebeece97de34d6584515a0d38539455052 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1444/1541] 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 18ab33e614d58f882d0bf89ae5c2e645731b5474 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1445/1541] 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 eea8e8570ef73d3c28bd5e6e161ce34a06ec6bbd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1446/1541] 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 8f3ee56e53be00040c223dc17337b18c2fcb06fb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1447/1541] 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 48b2af6075e71f606653d5aed85d8cafe359ef37 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1448/1541] 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 120cf6698f29a5902dc295f7f1b628e61018653b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1449/1541] 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 00997f3d0ada7671d45d58ca3c48066cd4f58a61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1450/1541] 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 40fd9966aaa752caab34bddecf6abc0ab9a3a239 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1451/1541] 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 4a59e3c65ed726cec24e3af9f5226d98a5e39289 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1452/1541] 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 2709b7c6c893e22526b4d3e071a6d31f20941185 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1453/1541] 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 cfe2d0c30a4af9a03dfda2b40ef1424963bb36f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1454/1541] 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 c21680fb0b0a56677df79dceca3593804ff42090 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1455/1541] 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 b56a82fa416a284b592dbff79cc7bf82c38a2cc7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1456/1541] 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 c545015ba889a6cded235572967c3173306d70d2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1457/1541] 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 26202d4ff81764f0cfcf067772123fe33b3638f2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1458/1541] 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 a15c306def2c561965025de17a03530f13275ed8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1459/1541] 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 4925c16521ed48cf829a0d738a5fd717410365d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1460/1541] 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 8b405f499d465454d0ef54a66275d3aa0ebf198c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1461/1541] 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 83c7c40861930d4a2a5d8bc36796927c6e811c5b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1462/1541] 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 092ce7b1e6312f48cb26fbad39e24bca6b1b749f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1463/1541] 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 4437dd493ea70c2edecbf7cd822d75e78b613d1a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1464/1541] 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 a2122ebd841dcb8dba0d3681f4e5003f2c9b067c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1465/1541] 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 eb6f2957f0373dab74a638bac57d820abcc34b94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1466/1541] 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 5df99e32236e74e66ae9e1f90719ee69f051129d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1467/1541] 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 a45b2191abe1ba2cb04f703fa48c0bca7a35f2ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1468/1541] 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 7d1c6eee20883dbe0a8c39d125516bba4b207a55 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1469/1541] 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 a6bcf8ec5a666ae560df4739e46c648032b712e1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1470/1541] 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 5736ee8b4a5821bf39f2ee3ecef3dda8ba681ca2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1471/1541] 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 67aa4909cfd229830c21e10cb908d9db67e25505 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1472/1541] 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 886996c26047aad8af4c9c6d2d4ed114f4ab9406 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1473/1541] 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 30ee3baec0467b47d3e2a69dda5a08fbf87c7e25 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1474/1541] 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 63e8e4dae1c0ababef3b0392f31b62dc18b41f09 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1475/1541] 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 96424daaae759070fefbad55016a846b86e9ba23 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1476/1541] 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 ba2ae636f24fff14e5c16543eca2dd45cae045f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1477/1541] 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 f755c35d42aa969588171275a30665495912ef46 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1478/1541] 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 a19f6a26c0a7f19f19c8a7877fa5c233e245b26a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1479/1541] 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 e053f24ae21871f540d074f60010676231ba0a7c Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1480/1541] 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 583e0ccc9b11fc745d2bbc0990f83d2d9ffb893c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1481/1541] 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 5e88e363b58c63f77818a136cd0fb9632685247a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1482/1541] 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 b22a5f8493b4cb9aa49c71cc94c656c086951354 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1483/1541] 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 b325a3eec256357dbe8aaf1000c667e9da0584f9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1484/1541] 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 9a597ea5e499649b733c6f685d211680783a548f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1485/1541] 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 13dc3a14efeffe4ac82b3c171c50cf427896cec7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1486/1541] 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 470b69b902bdda99147fba26b20ed503925ef27b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1487/1541] 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 1862d617ebe7c50980ec60421f3180128513f0b5 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1488/1541] 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 806dab5eb31b21f8e8910aa8b4ea4e64866f9885 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1489/1541] 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 49b2fbb61fe897dd614141ae4192d07a8093faab Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1490/1541] 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 738a00af02178036921559dcde4e31722c08642b Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1491/1541] 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 37fd379c538692442dde8f91c37f2ceb8ff795f0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1492/1541] 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 8d97c0709519e0dfa714b6340cb8ed33e5cd281c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1493/1541] 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 94e47af0c7709765f58eb1a9a4a121af18dbb676 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1494/1541] 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 2d698b73430516dbd39866258e2be60d35d08018 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1495/1541] 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 7a0ca68802d7faa36eb50b0cab2d67cada84cbf3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1496/1541] 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 06afb1bd53188ece15b51bb1a486fc1a3d68cc7e Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1497/1541] 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 7c99ed7b2dbca807a3d64c91b56c6e3999547d99 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1498/1541] 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 d19ebfcd842e9aeeabac43ff54599f09191d1a73 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1499/1541] 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 593adcda238dcf3aab8bbce5897adb9fb9d67191 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1500/1541] 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 25a8e0787c2e2ce3c3d3b56e5870bfc10822225d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1501/1541] 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 5c966b43c6b3a3e6e250910fa90e0f4e6cfe71da Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1502/1541] 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 05ada9baa86a27f3ec57e3b1a81177f218dfed1d Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1503/1541] 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 ccb881500046c8236c7d4a451ec5b1c180e25a5d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1504/1541] 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 ab61d2bcffad055d5e45b306bbdc4ee3b4a7c933 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1505/1541] 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 ecdff66203f408e3862fb19596ecd3119570ec5a Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1506/1541] 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 e5c52a0ff8f6b9cdd97276bfd79b0e12a3d83088 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1507/1541] 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 f710bed423d77af775375cd3cf729c6af0472e57 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1508/1541] 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 1033f2d7a8de36ee884245dae5e4be831455ca4a Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1509/1541] 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 e2bdfd375594195086c09f47f9a657fb3abc6058 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1510/1541] 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 dba1a867bc48f213b8dc2fc4e70c38993fde5022 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1511/1541] 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 2bbfa4551b8c94b86476343206334851c5bf66c7 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1512/1541] 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 bc05771de748aaab12662f69db2597e4be4f1180 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1513/1541] 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 88481392a1064a96b2c7f8a7df71b60a69ce7f04 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1514/1541] 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 e95c3420a6505aae68febbe633f75dcc0238797c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1515/1541] 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 e13ce2e96852e26d07e2b224e3fe6519afb1dce9 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1516/1541] 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 29f84c45719c58a66ffb8073310b8ad641ee5808 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1517/1541] 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 55b4311dc7a5fbd9e36206518856a9c5119288f3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1518/1541] 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 a82c8732039d42419fbe961c89d2ea4a87042803 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1519/1541] 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 a522b176268f04fa13b2b3c8483f35f15b387514 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1520/1541] 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 0bd615f2428b602611746622a178f23413e4eafa Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1521/1541] 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 92ac8ff56207ed12b8f6381d429db1f528dafbbe Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1522/1541] 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 3c4b4ee0fbdcd56dd5f21d74b756fcfc8484e34c Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1523/1541] 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 adb7e764c6c57df5cb448190a9513e62d54b1a61 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1524/1541] 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 385d72076634cef68fc14ddbecc180bd8688bf25 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1525/1541] 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 74f2864331195ff696ad27b80973b800901ccdbb Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1526/1541] 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 89d26b9b4a6e7dd219a2829c5b4ffc4f0a81d7d0 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1527/1541] 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 58288201d3d852d7307220fbfdbc1e8e77663549 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1528/1541] 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 22902bf6ed3b507248131f06ccd027f9b6298b94 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1529/1541] 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 3bbcd46fbbbf956f97ed79d4435edefacaa5d8ed Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1530/1541] 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 0dbff361d5cbc42745254cd0ed2b0104365547cb Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1531/1541] 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 bda125bd3c4d2584e74de051dc2a4b0fbe0df3c4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1532/1541] 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 cbb0be476ba32cc466fab9b0aeb5b47d8d65189f Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1533/1541] 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 f82805eb6bb3347f197cda85f42f6510caac07b2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1534/1541] 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 e455cdee5d43c747040245e55f56cb4da87f5701 Mon Sep 17 00:00:00 2001 From: nikhil Date: Thu, 22 Apr 2021 22:15:51 +0530 Subject: [PATCH 1535/1541] 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 db38ba8e8573324b308f5617ef4c943ba0bcd247 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sun, 25 Apr 2021 12:36:05 +0530 Subject: [PATCH 1536/1541] 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 535edc8d840efd8d2b9ec0d41b828483a98acb4d Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 29 May 2021 20:41:25 +0530 Subject: [PATCH 1537/1541] support for S3ObjectAcl in the acmpca_certificate_authority --- ...source_aws_acmpca_certificate_authority.go | 10 +++ ...e_aws_acmpca_certificate_authority_test.go | 80 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index a569d394a81..ac87bc1308d 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -236,6 +236,12 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 255), }, + "s3_object_acl": { + Type: schema.TypeString, + Optional: true, + Default: acmpca.S3ObjectAclPublicRead, + ValidateFunc: validation.StringInSlice(acmpca.S3ObjectAcl_Values(), false), + }, }, }, }, @@ -602,6 +608,9 @@ func expandAcmpcaCrlConfiguration(l []interface{}) *acmpca.CrlConfiguration { if v, ok := m["s3_bucket_name"]; ok && v.(string) != "" { config.S3BucketName = aws.String(v.(string)) } + if v, ok := m["s3_object_acl"]; ok && v.(string) != "" { + config.S3ObjectAcl = aws.String(v.(string)) + } return config } @@ -668,6 +677,7 @@ func flattenAcmpcaCrlConfiguration(config *acmpca.CrlConfiguration) []interface{ "enabled": aws.BoolValue(config.Enabled), "expiration_in_days": int(aws.Int64Value(config.ExpirationInDays)), "s3_bucket_name": aws.StringValue(config.S3BucketName), + "s3_object_acl": aws.StringValue(config.S3ObjectAcl), } return []interface{}{m} diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index f2543d6ce26..d02dc3bfb1c 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -440,6 +440,56 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati }) } +func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_s3ObjectAcl(t *testing.T) { + var certificateAuthority acmpca.CertificateAuthority + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_acmpca_certificate_authority.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, + Steps: []resource.TestStep{ + // Test creating revocation configuration on resource creation + { + Config: testAccAwsAcmpcaCertificateAuthorityConfig_RevocationConfiguration_CrlConfiguration_s3ObjectAcl(rName, "BUCKET_OWNER_FULL_CONTROL"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAcmpcaCertificateAuthorityExists(resourceName, &certificateAuthority), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.expiration_in_days", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_bucket_name", rName), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_object_acl", "BUCKET_OWNER_FULL_CONTROL"), + ), + }, + // Test importing revocation configuration + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + // Test updating revocation configuration + { + Config: testAccAwsAcmpcaCertificateAuthorityConfig_RevocationConfiguration_CrlConfiguration_s3ObjectAcl(rName, "PUBLIC_READ"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAcmpcaCertificateAuthorityExists(resourceName, &certificateAuthority), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.expiration_in_days", "1"), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_bucket_name", rName), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_object_acl", "PUBLIC_READ"), + ), + }, + }, + }) +} + func TestAccAwsAcmpcaCertificateAuthority_Tags(t *testing.T) { var certificateAuthority acmpca.CertificateAuthority resourceName := "aws_acmpca_certificate_authority.test" @@ -797,6 +847,36 @@ resource "aws_acmpca_certificate_authority" "test" { `, testAccAwsAcmpcaCertificateAuthorityConfig_S3Bucket(rName), expirationInDays) } +func testAccAwsAcmpcaCertificateAuthorityConfig_RevocationConfiguration_CrlConfiguration_s3ObjectAcl(rName, s3ObjectAcl string) string { + return fmt.Sprintf(` +%s + +resource "aws_acmpca_certificate_authority" "test" { + permanent_deletion_time_in_days = 7 + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = "terraformtesting.com" + } + } + + revocation_configuration { + crl_configuration { + enabled = true + expiration_in_days = 1 + s3_bucket_name = aws_s3_bucket.test.id + s3_object_acl = "%s" + } + } + + depends_on = [aws_s3_bucket_policy.test] +} +`, testAccAwsAcmpcaCertificateAuthorityConfig_S3Bucket(rName), s3ObjectAcl) +} + func testAccAwsAcmpcaCertificateAuthorityConfig_S3Bucket(rName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { From e1dc052383c54dbad88f04e762bebf8706abb3d3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 29 May 2021 21:01:35 +0530 Subject: [PATCH 1538/1541] support for S3ObjectAcl in the acmpca_certificate_authority --- aws/resource_aws_acmpca_certificate_authority.go | 1 + website/docs/r/acmpca_certificate_authority.html.markdown | 1 + 2 files changed, 2 insertions(+) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index ac87bc1308d..218ded5dbc8 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -239,6 +239,7 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { "s3_object_acl": { Type: schema.TypeString, Optional: true, + Computed: true, Default: acmpca.S3ObjectAclPublicRead, ValidateFunc: validation.StringInSlice(acmpca.S3ObjectAcl_Values(), false), }, diff --git a/website/docs/r/acmpca_certificate_authority.html.markdown b/website/docs/r/acmpca_certificate_authority.html.markdown index b01d4fb2755..8e53c7298ce 100644 --- a/website/docs/r/acmpca_certificate_authority.html.markdown +++ b/website/docs/r/acmpca_certificate_authority.html.markdown @@ -132,6 +132,7 @@ Contains information about the certificate subject. Identifies the entity that o * `enabled` - (Optional) Boolean value that specifies whether certificate revocation lists (CRLs) are enabled. Defaults to `false`. * `expiration_in_days` - (Required) Number of days until a certificate expires. Must be between 1 and 5000. * `s3_bucket_name` - (Optional) Name of the S3 bucket that contains the CRL. If you do not provide a value for the `custom_cname` argument, the name of your S3 bucket is placed into the CRL Distribution Points extension of the issued certificate. You must specify a bucket policy that allows ACM PCA to write the CRL to your bucket. Must be less than or equal to 255 characters in length. +* `s3_object_acl` - (Optional) Determines whether the CRL will be publicly readable or privately held in the CRL Amazon S3 bucket. Defaults to `PUBLIC_READ`. ## Attributes Reference From afa14416d4b3a8b8ab132ec8bc547c9bc51a5afa Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 29 May 2021 21:14:11 +0530 Subject: [PATCH 1539/1541] support for S3ObjectAcl in the acmpca_certificate_authority --- aws/resource_aws_acmpca_certificate_authority.go | 1 - 1 file changed, 1 deletion(-) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index 218ded5dbc8..c667f22507e 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -240,7 +240,6 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - Default: acmpca.S3ObjectAclPublicRead, ValidateFunc: validation.StringInSlice(acmpca.S3ObjectAcl_Values(), false), }, }, From 3efc6fabe76874dd4c63f3d705c5c7adc897daea Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jun 2021 16:48:35 -0400 Subject: [PATCH 1540/1541] Add CHANGELOG entry. --- .changelog/19578.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/19578.txt diff --git a/.changelog/19578.txt b/.changelog/19578.txt new file mode 100644 index 00000000000..c02aad104ec --- /dev/null +++ b/.changelog/19578.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_acmpca_certificate_authority: Add `s3_object_acl` argument to `revocation_configuration.crl_configuration` configuration block +``` \ No newline at end of file From df027cf702b9c34ea6d14f953a8ca55ee9da547c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jun 2021 16:59:06 -0400 Subject: [PATCH 1541/1541] r/aws_acmpca_certificate_authority: Tweak acceptance tests. --- aws/resource_aws_acmpca_certificate_authority_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index d02dc3bfb1c..274be156278 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -403,6 +403,7 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.enabled", "true"), resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.expiration_in_days", "1"), resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_bucket_name", rName), + resource.TestCheckResourceAttr(resourceName, "revocation_configuration.0.crl_configuration.0.s3_object_acl", "PUBLIC_READ"), ), }, // Test importing revocation configuration @@ -440,7 +441,7 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati }) } -func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_s3ObjectAcl(t *testing.T) { +func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_S3ObjectAcl(t *testing.T) { var certificateAuthority acmpca.CertificateAuthority rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_acmpca_certificate_authority.test"